当前位置:  开发笔记 > 编程语言 > 正文

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

如何解决《使用PowerShell设置新的smb共享时出错》经验,为你挑选了1个好方法。

我正在编写一个PowerShell脚本,它将在c驱动器上设置文件夹结构,然后将这些文件夹转换为共享.

使用New-SmbSharecmdlet时,我收到1332或50错误.

使用域我得到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

如果我删除域名,我会得到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

如果我删除了-ContinuouslyAvailable,我可以创建共享-ReadAccess,但我希望能够从脚本中分配用户或安全组权限.

为了设置smb共享并使用PowerShell分配用户或安全组,我需要更改什么?



1> Owain Esau..:

你需要删除-ContinuouslyAvailable标志.据我所知,无论如何,此标志默认设置为True.

您可能还想看看这些:

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/

由于该功能可能在您的环境中不可用,因此出现New-SmbShare : The request is not supported.错误

和你的第一个错误: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/

也许从这里尝试一下这个例子:

https://sharepoint.stackexchange.com/questions/134715/new-smbshare-no-mapping-between-account-names-and-security-ids-was-done

推荐阅读
跟我搞对象吧
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有