到目前为止,我已尝试使用编辑组策略 – >配置 – > Windows – >脚本 – >启动,我执行它
net use x: \\server\share /user:username password
没有成功.登录后,网络驱动器在Windows资源管理器中被视为断开连接的网络驱动器.
然而,在发布答案内容之前,我是否可以建议您过度复杂?
在这样的情况下,一些蹩脚的代码片段需要用户登录才能运行(如Domino服务器,抱怨)我创建了一个服务帐户,该帐户始终在给定服务器上登录,并设置自动登录脚本,这样机器会在重启时自动登录指定的帐户.我建议对您的问题更简单,更可支持的解决方案是做同样的事情,并通过组策略或登录脚本为该服务帐户用户映射驱动器.
无论如何,如果您决定在没有用户背景的情况下尝试此操作,请参阅下文.这是一个黑客,所以使用风险和所有:
For this hack you will need SysinternalsSuite by Mark Russinovich: 07001
Step one: Open an elevated cmd.exe prompt (Run as administrator)
Step two: Elevate again to root using PSExec.exe: Navigate to the folder containing SysinternalsSuite and execute the following command “psexec -i -s cmd.exe” you are now inside of a prompt that is “nt authority\system” and you can prove this by typing “whoami”. The -i is needed because drive mappings need to interact with the user
Step Three: Create the persistent mapped drive as the SYSTEM account with the following command “net use z: \servername\sharedfolder /persistent:yes”
It’s that easy!
WARNING: You can only remove this mapping the same way you created it,from the SYSTEM account. If you need to remove it,follow steps 1 and 2 but change the command on step 3 to: “net use z: /delete”
NOTE: The newly created mapped drive will now appear for ALL users of this system but they will see it displayed as “Disconnected Network Drive (Z:)”. Do not let the name fool you. It may claim to be disconnected but it will work for everyone. That’s how you can tell this hack is not supported by M$.
来自评论:
To get it working after a reboot,create a script just containing net use z: \servername\sharedfolder and set it to run on computer startup,per technet.microsoft.com/en-us/library/cc770556.aspx This will run as the SYSTEM account,so no need for psexec.