LuckyDuck528
Programmer
Please advise if this is the wrong place to post my question...
I have a file called WebPub.vbs sitting on a Win2003 Server that I would like to be able to execute on the server from my desktop using WinXP Pro. So far, the only part I have had any success with is mapping and disconnecting the drive. I can't seem to figure out the proper way to write the middle section (seen in red) to actually access the drive I mapped, change dir, and then run the file. Is this even possible?
I came across another post similar to this question in which the solution got as far as looking into using "net use". So, I looked into it, and have not had any further success.
Thank you in advanced for your time and help!
Here is my current code:
I have a file called WebPub.vbs sitting on a Win2003 Server that I would like to be able to execute on the server from my desktop using WinXP Pro. So far, the only part I have had any success with is mapping and disconnecting the drive. I can't seem to figure out the proper way to write the middle section (seen in red) to actually access the drive I mapped, change dir, and then run the file. Is this even possible?
I came across another post similar to this question in which the solution got as far as looking into using "net use". So, I looked into it, and have not had any further success.
Thank you in advanced for your time and help!
Here is my current code:
Code:
Option Explicit
Dim arrServers, inta, objFile, objFolder
Dim objFSO, objWS, strRunMe1, objNet, strRunMe
arrServers = Array ("JHWSDV13")
'***********************************************************
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWS = WScript.CreateObject("WScript.Shell")
Set objNet = CreateObject("WScript.Network")
'***********************************************************
For inta = LBound(arrServers) To UBound(arrServers)
objNet.MapNetworkDrive "H:", "\\" & arrServers(inta) & "\C$"
[COLOR=red]
objWS.Run "cmd net use /c H: \\JHWSDV13\C$\sysapps\batch\WebPub.vbs"
[/color]
objNet.RemoveNetworkDrive "H:"
Next