How to map a drive for a windows service

mappeddrivenetwork-attached-storagewindows-server-2003-r2windows-service

I am supporting the installation of a CCTV system from the Windows 2003 R2 Standard side of the equation, the intention was to use use a NAS for long term storage (quite a lot of data is generated in a fairly short time). The one snag we have run into is the CCTV software can only point to local drives and folders for its archival location.

I have looked at Junction Points (which are not supported on remote file systems), Symbolic Links (which are not available on Windows 2003) and Remote Storage Services (which is not available in Windows 2003 Standard).

Because the CCTV software runs as a Windows Service (4 of them to be exact), it is not immediately obvious how to do this, my current solution is as follows:

  1. Create a new local account for the services
  2. Add this account to the local Administrator Group
  3. Login using this account
  4. Setup the mapped network drive through
    net use z: \nas\share /savecred
  5. Switch the four services to use the local account
  6. Restart the services

Surprisingly this worked, it feels like a horrible cludgy way to solve a problem. Is there a better way?

Best Answer

Windows occasionally "loses" mapped drives. You might want to run a periodic job to check for the existence of "Z:" and remount it if it's not there.