Map a network drive to be used by a service

前端 未结 12 2271
再見小時候
再見小時候 2020-11-22 10:43

Suppose some Windows service uses code that wants mapped network drives and no UNC paths. How can I make the drive mapping available to the service\'s session when the servi

12条回答
  •  青春惊慌失措
    2020-11-22 11:43

    Found a way to grant Windows Service access to Network Drive.

    Take Windows Server 2012 with NFS Disk for example:

    Step 1: Write a Batch File to Mount.

    Write a batch file, ex: C:\mount_nfs.bat

    echo %time% >> c:\mount_nfs_log.txt
    net use Z: \\{your ip}\{netdisk folder}\ >> C:\mount_nfs_log.txt 2>&1
    

    Step 2: Mount Disk as NT AUTHORITY/SYSTEM.

    Open "Task Scheduler", create a new task:

    1. Run as "SYSTEM", at "System Startup".
    2. Create action: Run "C:\mount_nfs.bat".

    After these two simple steps, my Windows ActiveMQ Service run under "Local System" priviledge, perform perfectly without login.

提交回复
热议问题