Powershell New-NfsShare 无效的命名空间

标签 powershell network-share

我正在尝试使用 New-NfsShare 命令创建网络共享,但我不断收到无效的命名空间错误。我几乎是从提供的示例中逐字逐句写的,所以我不明白有什么问题。

示例:New-nfsShare -Name "NFSshare01" -Path "C:\shares\NFSshare01"
我的代码:New-NfsShare -Name "LABS" -Path "C:\LABS" -Permission readwrite
有谁知道发生了什么?我已经将 NFS 模块导入到 Powershell 中,我什至尝试先创建目录,以防由于某种原因命令无法在创建网络共享之前创建项目。我正在使用 Windows Server 2012 和 powershell 3.0 版

最佳答案

我在我的两个 Windows 2012 系统上进行了测试。在一个 没有 NFS 角色的服务器,我得到同样的错误:

PS C:\> New-NfsShare -Name 'Temp' -Path 'C:\Temp' -Permission readwrite
New-NfsShare : Invalid namespace
At line:1 char:1
+ New-NfsShare -Name 'Temp' -Path 'C:\Temp' -Permission readwrite
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : MetadataError: (MSFT_NfsServerTasks:root/Microsoft/..._NfsServerTasks) [New-NfsShare], C
   imException
    + FullyQualifiedErrorId : HRESULT 0x8004100e,New-NfsShare

但是在我的系统上 安装了该角色,它工作得很好(从提升的提示符执行):
PS C:\> New-NfsShare -Name 'Temp' -Path 'C:\Temp' -Permission readwrite

Name                                    Availability                            Path
----                                    ------------                            ----
Temp                                    Standard (not clustered)                C:\Temp

检查以确保您的系统启用了该角色:
PS C:\Windows\system32> Get-WindowsFeature | Where-Object { $_.Name -match 'NFS' }

Display Name                                            Name                       Install State
------------                                            ----                       -------------
        [X] Server for NFS                              FS-NFS-Service                 Installed
[ ] Client for NFS                                      NFS-Client                     Available
            [X] Services for Network File System Man... RSAT-NFS-Admin                 Installed

关于Powershell New-NfsShare 无效的命名空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38772076/

相关文章:

azure - 如何使用 Azure Function 输出绑定(bind)更新 Azure 存储表中的行

powershell - 如何从Powershell打开命令提示符

powershell - 如何从 SSIS 执行 PowerShell 脚本

powershell - 合并 Get-ADGroup 和 Get-ADUser 结果

windows - Git 是否可以通过网络共享?

iis - 401.1 访问指向网络共享的虚拟目录时出错

.NET 部署到网络共享

powershell - PowerShell 可以捕获 GetChildItem 中的错误并继续循环吗?

Git 推送到网络驱动器 : Cannot pread pack file

database-connection - H2 自动混合模式是从不同客户端访问网络共享上的数据库的正确方法吗?