windows服务无法访问网络共享映射的驱动器路径

How to map network shares into drives to a Windows service permanently (ibm.com)icon-default.png?t=N3I4https://www.ibm.com/support/pages/how-map-network-shares-drives-windows-service-permanently

Question

How to map network shares into drives to a Windows service permanently

Answer

In order for network shares to be mapped into drives and accessible within Windows services, you need to login as the NT AUTHORITY\SYSTEM account.

To do this, download the Sysinternals Suite from Microsoft and unzip it to a directory say C:\TEMP

The following steps assume that you've unzipped SysInternals to C:\TEMP and all the executables are in there.

  1. Launch a command prompt as Administrator.
  2. CD \TEMP
  3. psexec -i -s cmd.exe
    This launches a new command prompt window and step 4 should be performed in that new window.
  4. net use Z: \\servername_OR_IP\sharedfolder /u:username /persistent:yes
    Provide the credentials of a user having access to the shared folder.
  5. Create a script that runs on computer startup that has only line 4 in it acccording to Microsoft's article: Assign Computer Startup scripts.

If you need to remove it

  1. Launch a command prompt as Administrator.
  2. CD \temp
  3. psexec -i -s cmd.exe
    This launches a new window. Step 4 should be entered in that window.
  4. net use Z: /delete

NOTE: If you are using Windows 8 or Windows 2012 and you receive an error executing the net use command please follow this articlefrom Microsoft support knowledge base to fix it.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值