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?