简体   繁体   English

使用PowerShell设置新的smb共享时出错

[英]Error while setting up a new smb share using powershell

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. 我正在编写一个PowerShell脚本,它将在c驱动器上设置文件夹结构,然后将这些文件夹转换为共享。

When using the New-SmbShare cmdlet I'm getting a 1332 or a 50 error. 使用New-SmbShare cmdlet时,我收到1332或50错误。

With the Domain I get a 1332 Error 使用域我得到1332错误

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. 如果我删除域名,我会得到50错误。

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. 我能够创建共享,如果我删除-ContinuouslyAvailable-ReadAccess ,但我希望能够从脚本分配的用户或安全组的权限。

What do I need to change in order to setup an smb share and assign users or security groups using PowerShell? 为了设置smb共享并使用PowerShell分配用户或安全组,我需要更改什么?

You need to remove the -ContinuouslyAvailable flag. 您需要删除-ContinuouslyAvailable标志。 As far as I know, this flag is set to True by default anyway. 据我所知,无论如何,此标志默认设置为True。

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://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/ 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. 由于该功能可能在您的环境中不可用,因此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: 和你的第一个错误: No mapping between account names and security IDs was done ,我相信这基本上意味着“找不到用户”,请看这里:

http://www.rebeladmin.com/2016/01/how-to-fix-error-no-mapping-between-account-names-and-security-ids-in-active-directory/ 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 https://sharepoint.stackexchange.com/questions/134715/new-smbshare-no-mapping-between-account-names-and-security-ids-was-done

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM