Powershell – Mount NFS from PowerShell on Windows 2012 and be visible elsewhere

nfspowershellwindows-server-2012

I'd like to mount an NFS share from Windows 2012 using PowerShell and have this mount be visible in contexts other than the PowerShell session that invoked it. If I use the New-PSDrive command (cmdlet?), e.g.:

New-PSDrive Z -PsProvider FileSystem -Root \\10.40.1.1\export\isos

Then it will mount the NFS server to the Z drive, but I can't access this drive in, say, File Explorer.

Best Answer

Kernel Panic is correct about the PSDrive cmdlet being usable only within the PowerShell environment. The TechNet article ‘Using the New –PSDrive Cmdlet’ states ‘Mapped drives last only as long as your current Windows PowerShell session.’ However, you can create a configuration file that will re-map the drives every time you start PowerShell.

Further, the TechNet Article ‘Converting the Windows Script Host MapNetworkDrive Method’ also states that any drive created with the –PSDrive cmdlet ‘can be used exactly like any other mapped network drive as long as you are working in Windows PowerShell.’ This is a PowerShell Drive and not a true mapped drive. This article goes on to show that you can map drives in PowerShell using the Net Use command:

net use z: \\server\folder

Hope this helps,