Procedure:
Create script to map the drives. e.g. mount.ps1
Create script to map the drives. e.g. mount.ps1
For each drive use following command:
New-PSDrive -Name "X" -PSProvider FileSystem - Root "\\nfs_server_host_or_ip\nfs_path" -Persist
where:
X is mapped drive letter
nfs_server_host_or_ip ... is clear, right?
nfs_path .. is also clear
example:
New-PSDrive -name "G" -PSProvider FileSystem -Root "\\192.168.1.1\nfsvolume" -Persist
Create new scheduled task:
- For running use SYSTEM account (on General tab, click on "Change User and Group" then click on "Advanced", "Find Now" and select user "SYSTEM" ... Ok, Ok, Ok)
- As a trigger set "At system startup"
- Under Action tab run powershell and as a parameter "-file mount.ps1"
And restart Windows server :)
Remarks:
- All services which are accessing the NFS drive must be running under local system account
- If you try to execute New-PSDrive manually under an user account, the services above won't be able to access the drive (you must run powershell under system account - download PSTools from http://www.sysinternals.com and start powershell using command: PSExec.exe /SID PowerShell.exe - then it will work)
- To remove the drives use Remove-PSDrive X command
- The icons for the drives will have red cross over them... anyway it works! :)