Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute Server File from Remote Desktop

Status
Not open for further replies.

LuckyDuck528

Programmer
Dec 21, 2004
65
US
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 possible?

Thank you in advanced for your time and help! [smile]

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 /c net use [H: \\JHWSDV13\C$[\sysapps\batch] [W1n5t0n] ] % z: & cd C:\sysapps\batch\WebPub.vbs JHWSDV13"   
[/color]
objNet.RemoveNetworkDrive "H:"
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top