Saturday, 20 December 2014

How to mount a Windows Network Drive as a service

Problem Description:

How to mount a Windows Network Drive as a service.



1) Install Windows sysinternals suites from the following link
https://technet.microsoft.com/en-us/sysinternals/bb842062

2) Create the batch file as shown in the screen shot below.
echo ... >> D:\work\drivemounts\drivemount.log
echo =================================================== >> D:\work\drivemounts\drivemount.log
echo %DATE% %TIME% >> D:\work\drivemounts\drivemount.log
echo =================================================== >> D:\work\drivemounts\drivemount.log
net use P: /delete >> D:\work\drivemounts\drivemount.log
net use P: \\10.200.113.15\psoft /persistent:yes /user:domain\user <password> >> D:\work\drivemounts\drivemount.log
echo =================================================== >> D:\work\drivemounts\drivemount.log
echo ... >> D:\work\drivemounts\drivemount.log


 3) download NSSM from the following URL 
http://www.nssm.cc/

4)  use NSSM to schedule the MountNetworkDrives as services as shown in the screen shot above.
nssm.exe edit MountNetworkDrives

Let me know, if you have any questions. 

Thanks
Zafrulla Khan.

 







No comments:

Post a Comment