LiveWire Peer Support Network

Printable Version of Topic "Run a .vbs on a remote PC"

- LiveWire Teen Forums & College Forums (http://www.golivewire.com)
-- (http://www.golivewire.com/forums/support-technical.html)
--- Programming & Application Development (http://www.golivewire.com/forums/forum-211-s-0.html)
---- Run a .vbs on a remote PC (http://www.golivewire.com/forums/peer-yeboyy-support-a.html)


-- Posted by mary21 at 10:56 am on April 15, 2005

Hi,

I'm new to VBscript and trying to get MyProgram.vbs to run on a remote PC but it wont do anything....the program runs fine on my local machine, any help would be much appreciated...here's the code I have for running a remote program:


'==========================
'Remote.vbs
'==========================

Const OverwriteExisting = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\Scripts\MyProgram.vbs", _
   "\\remoteIPAddress\C$\Scripts\",OverWriteExisting

strComputer = "remoteIPAddress"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")

Error = objWMIService.Create("c:\scripts\MyProgram.vbs", null, null,intProcessID)

If Error = 0 Then
       MsgBox (strProcess & " was started with a process ID of " & intProcessID & ".")
   
Else
       MsgBox (strProcess & " could not be started due to error " & _
       errReturn & ".")
   
End If

=================================

So it does copy the program to c:\Scripts of the remote PC but it wont run the program...I do believe that it kicks of a wscript process in the process list on task manager.  Please help :)


-- Posted by squirellplayingtag at 5:42 am on May 6, 2006

Have you checked if the remote machine has .net installed?


www.golivewire.com