I'm working on writing a PowerShell script that will setup a folder structure on the c drive and then turn those folders into shares.
When using the New-SmbShare
cmdlet I'm getting a 1332 or a 50 error.
With the Domain I get a 1332 Error
New-SmbShare -Name "InstallerFiles" -Path "C:\SoftwareDistribution\InstallerFiles" -ContinuouslyAvailable $true -ReadAccess "domain\Authenticated Users"
New-SmbShare : No mapping between account names and security IDs was done.
At line:1 char:1
+ New-SmbShare -Name "InstallerFiles" -Path "C:\SoftwareDistribution\InstallerFile ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (MSFT_SMBShare:ROOT/Microsoft/Windows/SMB/MSFT_SMBShare) [New-SmbShare], CimException
+ FullyQualifiedErrorId : Windows System Error 1332,New-SmbShare
If I remove the domain I get the 50 Error.
New-SmbShare -Name "InstallerFiles" -Path "C:\SoftwareDistribution\InstallerFiles" -ContinuouslyAvailable $true -ReadAccess "Authenticated Users"
New-SmbShare : The request is not supported.
At line:1 char:1
+ New-SmbShare -Name "InstallerFiles" -Path "C:\SoftwareDistribution\InstallerFile ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (MSFT_SMBShare:ROOT/Microsoft/Windows/SMB/MSFT_SMBShare) [New-SmbShare], CimException
+ FullyQualifiedErrorId : Windows System Error 50,New-SmbShare
I'm able to create the Share if I remove -ContinuouslyAvailable
and -ReadAccess
, but I want to be able to assign the users or security groups permissions from the script.
What do I need to change in order to setup an smb share and assign users or security groups using PowerShell?
You need to remove the -ContinuouslyAvailable
flag. As far as I know, this flag is set to True by default anyway.
You may also want to take a look at these:
https://social.technet.microsoft.com/Forums/en-US/0666a96f-d8c9-4a20-b994-10a003cd7047/big-performance-isssue-cafs-and-10-gbe-network?forum=winserverfiles
https://blogs.technet.microsoft.com/davguents_blog/2012/10/21/windows-server-2012-continuous-availability-file-server-feature/
As the function may not be available in your environment, hence the New-SmbShare : The request is not supported.
Error
and your first error: No mapping between account names and security IDs was done
, i believe this basically means "user not found" see here:
http://www.rebeladmin.com/2016/01/how-to-fix-error-no-mapping-between-account-names-and-security-ids-in-active-directory/
and maybe try the example from here:
https://sharepoint.stackexchange.com/questions/134715/new-smbshare-no-mapping-between-account-names-and-security-ids-was-done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With