VBScript access network share from domain

佐手、 提交于 2020-01-25 16:39:06

问题


I'm trying to access and run setup.exe from a server on the same network.

  • The pc where i'm trying to access the file from is in a domain.
  • The server is not in the domain.

This code works only if both pc's are without domain:

Set WshNetwork = WScript.CreateObject("WScript.Network")

WshNetwork.RemoveNetworkDrive "M:", True, True

WshNetwork.MapNetworkDrive "M:", "\\192.168.0.10\share", myUserName, myPassword

Set shell = WScript.CreateObject("Wscript.Shell")
shell.CurrentDirectory = "M:\Setup"
shell.Run("setup.exe"), 0 , True

WshNetwork.RemoveNetworkDrive "M:", True, True
  • If i try to run this code for my situation i get an error that username or password is wrong, but it isn't.
  • If i manually map the drive and run the code then it works
  • If i remove the map drive then the error is back.

What extra details do i have to add so the pc can access the file from the server?

来源:https://stackoverflow.com/questions/38921116/vbscript-access-network-share-from-domain

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!