create hidden shares and set share permissions


i create hidden shares and set share permssions for subfolders.  came across powershell script , able create shares (not hidden) with their share name folder names.

"get-childitem | where-object { $_.psiscontainer } | foreach-object { invoke-expression -command ([string]::concat("net share ",$_,"=",(get-location).path,"\",$_," ""/grant:everyone,full"" ""/users:unlimited"""))}"

but couldn't working when tried create hidden shares adding $ @ end of ",$_," . script this.

get-childitem | where-object { $_.psiscontainer } | foreach-object { invoke-expression -command ([string]::concat("net share ",$_,"=",(get-location).path,"\",$_,$" ""/grant:everyone,full"" ""/users:unlimited"""))}

does know what's wrong in script. in advance!


this posting provided as-is no warranties/guarantees , confers no rights.

try

get-childitem|where-object{ $_.psiscontainer } |foreach-object{ invoke-expression-command([string]::concat("net share ",$_,"=",(get-location).path,"\",$_,"$ ""/grant:everyone,full"" ""/users:unlimited"""))}



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file