【问题标题】:Error while setting up a new smb share using powershell使用 powershell 设置新的 smb 共享时出错
【发布时间】:2018-08-02 20:56:39
【问题描述】:

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

使用 New-SmbShare cmdlet 时,我收到 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,我可以创建共享,但我希望能够从脚本中分配用户或安全组权限。

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

【问题讨论】:

    标签: windows powershell smb


    【解决方案1】:

    您需要删除-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

    【讨论】:

    • 感谢您的帮助,删除-ContinuouslyAvailable修复错误。
    • -ContinuouslyAvailable 默认为$false。它适用于集群情况。
    猜你喜欢
    • 1970-01-01
    • 2014-10-29
    • 1970-01-01
    • 1970-01-01
    • 2010-12-24
    • 2018-11-22
    • 2017-11-21
    • 2011-11-22
    • 1970-01-01
    相关资源
    最近更新 更多