我正在尝试使用 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/