new-smbShare error - filename, directory anme .... syntax is incorrect. server 2012 R2

T

Tikesavage

i need to create a new shared folder on a remote server and then change the share permission for everybody to FullAccess. i cant figure it out after a whole day of fooling around.


i am able to use the new-item cmdlet to create the folder.

the new-smbshare is giving me the error below.




$Username = Test

## Name and Path for Personal drive folder
$ComputerName = "contoso"
$DriveLetter = "H"
$Path = "Users"
New-Item -Path \\$ComputerName\$DriveLetter$\$Path\$Username -type directory -Force

New-SmbShare -Name $Username -Path \\$ComputerName\$DriveLetter$\$Path\$Username -ReadAccess domain\Everyone



Here is the error

New-SmbShare : The filename, directory name, or volume label syntax is incorrect.
At line:5 char:5
+ New-SmbShare -Name $Username -Path \\$ComputerName\$DriveLetter$ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_SMBShare:ROOT/Microsoft/Windows/SMB/MSFT_SMBShare
) [New-SmbShare], CimException
+ FullyQualifiedErrorId : Windows System Error 123,New-SmbShare

Continue reading...
 
Back
Top Bottom