John John - 8 months ago 125
PowerShell Question

Powershell New-NfsShare Invalid namespace

I'm trying to use the New-NfsShare command to create a network share but I keep getting an invalid namespace error. I'm writing almost verbatim from the provided example so I don't get what's wrong.


New-nfsShare -Name "NFSshare01" -Path "C:\shares\NFSshare01"

My Code:
New-NfsShare -Name "LABS" -Path "C:\LABS" -Permission readwrite

Anyone know what is going on? I have already imported the NFS Module into Powershell and I even tried creating the directory first incase for some reason the command can't create the item before making a network share. I am using Windows Server 2012 and powershell version 3.0


I tested on two of my Windows 2012 systems. On the one without the Server for NFS role, I get the same error:

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
    + FullyQualifiedErrorId : HRESULT 0x8004100e,New-NfsShare

But on my system with that role installed, it works just fine (executed from an elevated prompt):

PS C:\> New-NfsShare -Name 'Temp' -Path 'C:\Temp' -Permission readwrite

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

Check to make sure your system has that role enabled:

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