Home All Groups Group Topic Archive Search About


Author
4 Aug 2005 7:57 PM
aquel
I have the following script that i want to run on remote machines:
On Error Resume Next

arrComputers = Array("AVST149")

For Each strComputer in arrComputers

    Set objWMIService = GetObject _
        ("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery _
        ("Select * From Win32_OperatingSystem")
    For Each objItem in ColItems
        HOW TO MAKE AN EXE RUN HERE???
    Next

Next

What would be the command to make an exe run on the target computer?

Author
4 Aug 2005 8:29 PM
Marty List
That depends on where the EXE resides.  Is it on your local machine, on a
server, or on each remote system?  Permissions will be an issue if it's not on
each remote system's hard drive.


Show quote
"aquel" <aq***@discussions.microsoft.com> wrote in message
news:D39365CB-0A01-40DC-8D04-21F5EF46C14C@microsoft.com...
> I have the following script that i want to run on remote machines:
> On Error Resume Next
>
> arrComputers = Array("AVST149")
>
> For Each strComputer in arrComputers
>
>     Set objWMIService = GetObject _
>         ("winmgmts:\\" & strComputer & "\root\cimv2")
>     Set colItems = objWMIService.ExecQuery _
>         ("Select * From Win32_OperatingSystem")
>     For Each objItem in ColItems
>         HOW TO MAKE AN EXE RUN HERE???
>     Next
>
> Next
>
> What would be the command to make an exe run on the target computer?
Author
4 Aug 2005 8:41 PM
aquel
The exe resides on Computer B; Im trying to execute from Computer A; The
account running the script will have the same permissions across the domain.
Is this whats called interactive execution?

Show quote
"Marty List" wrote:

>
> That depends on where the EXE resides.  Is it on your local machine, on a
> server, or on each remote system?  Permissions will be an issue if it's not on
> each remote system's hard drive.
>
>
> "aquel" <aq***@discussions.microsoft.com> wrote in message
> news:D39365CB-0A01-40DC-8D04-21F5EF46C14C@microsoft.com...
> > I have the following script that i want to run on remote machines:
> > On Error Resume Next
> >
> > arrComputers = Array("AVST149")
> >
> > For Each strComputer in arrComputers
> >
> >     Set objWMIService = GetObject _
> >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> >     Set colItems = objWMIService.ExecQuery _
> >         ("Select * From Win32_OperatingSystem")
> >     For Each objItem in ColItems
> >         HOW TO MAKE AN EXE RUN HERE???
> >     Next
> >
> > Next
> >
> > What would be the command to make an exe run on the target computer?
>
>
>
Author
4 Aug 2005 9:19 PM
Marty List
One of these should work for you:

WMI:
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/creating_processes_remotely.asp

WSH:
http://msdn.microsoft.com/library/en-us/script56/html/wsconRunningScriptsRemotelyRunningScriptOverThereFromHere.asp
http://msdn.microsoft.com/library/en-us/script56/html/wslrfRemote_WSHObject.asp


Show quote
"aquel" <aq***@discussions.microsoft.com> wrote in message
news:6EB07E49-0785-4D00-BC61-5D8D270403EB@microsoft.com...
> The exe resides on Computer B; Im trying to execute from Computer A; The
> account running the script will have the same permissions across the domain.
> Is this whats called interactive execution?
>
> "Marty List" wrote:
>
> >
> > That depends on where the EXE resides.  Is it on your local machine, on a
> > server, or on each remote system?  Permissions will be an issue if it's not
on
> > each remote system's hard drive.
> >
> >
> > "aquel" <aq***@discussions.microsoft.com> wrote in message
> > news:D39365CB-0A01-40DC-8D04-21F5EF46C14C@microsoft.com...
> > > I have the following script that i want to run on remote machines:
> > > On Error Resume Next
> > >
> > > arrComputers = Array("AVST149")
> > >
> > > For Each strComputer in arrComputers
> > >
> > >     Set objWMIService = GetObject _
> > >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> > >     Set colItems = objWMIService.ExecQuery _
> > >         ("Select * From Win32_OperatingSystem")
> > >     For Each objItem in ColItems
> > >         HOW TO MAKE AN EXE RUN HERE???
> > >     Next
> > >
> > > Next
> > >
> > > What would be the command to make an exe run on the target computer?
> >
> >
> >
Author
8 Aug 2005 7:42 PM
aquel
I composed the following script; it seems to spawn the exe on the remote
server but it stays on a hung status; if i check taskmanager i can see the
exe sitting there but not doing what its supose to do, any thoughts?
On Error Resume Next

Const x= "some.exe"


If Right(UCase(wscript.FullName), 11) = "WSCRIPT.EXE" Then
     wscript.echo "ERROR: You must run this script using cscript, for
example 'cscript " & wscript.scriptname & "'."
     wscript.quit 0
End If


ipFile = "RemoteServer"
PathToExe = "E:\folder\subFolder\"

Set onet = CreateObject("wscript.network")
Set ofs = CreateObject("scripting.filesystemobject")


' Make sure to end with a \ character.
If Right(PathToExe, 1) <> "\" Then
     PathToExe = PathToExe & "\"
End If

'Note that cim_datafile does not support UNC paths
'so everything must be handled through mapped drives.
If Left(PathToExe, 2) = "\\" Then
     wscript.echo "<PathToExe> cannot be a UNC path, please map a drive
locally"
     wscript.quit
End If

exeX = ofs.getfile(PathToExe + lifeCare).Name

Set osvcLocal = GetObject("winmgmts:root\cimv2")

'The error-handling code is below the function that may throw one - execute
it.
On Error Resume Next

'While Not oipFile.atEndOfStream

     ip = "SOMEIPAddress"
     wscript.echo vbCrLf & "Connecting to " & ip & "..."

     Err.Clear
     Set osvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2")

     If (Err.Number <> 0) Then
          wscript.echo "Failed to connect to " & ip & "."
     Else

          wscript.echo "Running some.exe" & "..."
      Set oprocess = osvcRemote.Get("win32_process")

          ' Run exe without user interaction
              ret = oprocess.Create("E:\\folder\\subFolder\\some.exe")
              If (ret <> 0) Then
                  wscript.echo "Failed to start process on " & ip & ": " & ret
                    Else

                     wscript.echo "Installation successful."

                    End If     'Create process succeeded.

     End If ' Do the next IP address, then the next IP address...


oipFile.close()

wscript.echo vbCrLf & "Run complete. Exiting."



Show quote
"Marty List" wrote:

>
> One of these should work for you:
>
> WMI:
> http://msdn.microsoft.com/library/en-us/wmisdk/wmi/creating_processes_remotely.asp
>
> WSH:
> http://msdn.microsoft.com/library/en-us/script56/html/wsconRunningScriptsRemotelyRunningScriptOverThereFromHere.asp
> http://msdn.microsoft.com/library/en-us/script56/html/wslrfRemote_WSHObject.asp
>
>
> "aquel" <aq***@discussions.microsoft.com> wrote in message
> news:6EB07E49-0785-4D00-BC61-5D8D270403EB@microsoft.com...
> > The exe resides on Computer B; Im trying to execute from Computer A; The
> > account running the script will have the same permissions across the domain.
> > Is this whats called interactive execution?
> >
> > "Marty List" wrote:
> >
> > >
> > > That depends on where the EXE resides.  Is it on your local machine, on a
> > > server, or on each remote system?  Permissions will be an issue if it's not
> on
> > > each remote system's hard drive.
> > >
> > >
> > > "aquel" <aq***@discussions.microsoft.com> wrote in message
> > > news:D39365CB-0A01-40DC-8D04-21F5EF46C14C@microsoft.com...
> > > > I have the following script that i want to run on remote machines:
> > > > On Error Resume Next
> > > >
> > > > arrComputers = Array("AVST149")
> > > >
> > > > For Each strComputer in arrComputers
> > > >
> > > >     Set objWMIService = GetObject _
> > > >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> > > >     Set colItems = objWMIService.ExecQuery _
> > > >         ("Select * From Win32_OperatingSystem")
> > > >     For Each objItem in ColItems
> > > >         HOW TO MAKE AN EXE RUN HERE???
> > > >     Next
> > > >
> > > > Next
> > > >
> > > > What would be the command to make an exe run on the target computer?
> > >
> > >
> > >
>
>
>
Author
8 Aug 2005 8:10 PM
Marty List
Are you sure "some.exe" is configured to run silently, with no user input
(unattended)?


Show quote
"aquel" <aq***@discussions.microsoft.com> wrote in message
news:E592ADF7-63EC-4881-8DF3-C0DE16321B28@microsoft.com...
> I composed the following script; it seems to spawn the exe on the remote
> server but it stays on a hung status; if i check taskmanager i can see the
> exe sitting there but not doing what its supose to do, any thoughts?
> On Error Resume Next
>
> Const x= "some.exe"
>
>
> If Right(UCase(wscript.FullName), 11) = "WSCRIPT.EXE" Then
>      wscript.echo "ERROR: You must run this script using cscript, for
> example 'cscript " & wscript.scriptname & "'."
>      wscript.quit 0
> End If
>
>
> ipFile = "RemoteServer"
> PathToExe = "E:\folder\subFolder\"
>
> Set onet = CreateObject("wscript.network")
> Set ofs = CreateObject("scripting.filesystemobject")
>
>
> ' Make sure to end with a \ character.
> If Right(PathToExe, 1) <> "\" Then
>      PathToExe = PathToExe & "\"
> End If
>
> 'Note that cim_datafile does not support UNC paths
> 'so everything must be handled through mapped drives.
> If Left(PathToExe, 2) = "\\" Then
>      wscript.echo "<PathToExe> cannot be a UNC path, please map a drive
> locally"
>      wscript.quit
> End If
>
> exeX = ofs.getfile(PathToExe + lifeCare).Name
>
> Set osvcLocal = GetObject("winmgmts:root\cimv2")
>
> 'The error-handling code is below the function that may throw one - execute
> it.
> On Error Resume Next
>
> 'While Not oipFile.atEndOfStream
>
>      ip = "SOMEIPAddress"
>      wscript.echo vbCrLf & "Connecting to " & ip & "..."
>
>      Err.Clear
>      Set osvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2")
>
>      If (Err.Number <> 0) Then
>           wscript.echo "Failed to connect to " & ip & "."
>      Else
>
>           wscript.echo "Running some.exe" & "..."
>   Set oprocess = osvcRemote.Get("win32_process")
>
>           ' Run exe without user interaction
>               ret = oprocess.Create("E:\\folder\\subFolder\\some.exe")
>               If (ret <> 0) Then
>                   wscript.echo "Failed to start process on " & ip & ": " & ret
>                     Else
>
>                      wscript.echo "Installation successful."
>
>                     End If     'Create process succeeded.
>
>      End If ' Do the next IP address, then the next IP address...
>
>
> oipFile.close()
>
> wscript.echo vbCrLf & "Run complete. Exiting."
>
>
>
> "Marty List" wrote:
>
> >
> > One of these should work for you:
> >
> > WMI:
> >
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/creating_processes_remotely.asp
> >
> > WSH:
> >
http://msdn.microsoft.com/library/en-us/script56/html/wsconRunningScriptsRemotelyRunningScriptOverThereFromHere.asp
> >
http://msdn.microsoft.com/library/en-us/script56/html/wslrfRemote_WSHObject.asp
Show quote
> >
> >
> > "aquel" <aq***@discussions.microsoft.com> wrote in message
> > news:6EB07E49-0785-4D00-BC61-5D8D270403EB@microsoft.com...
> > > The exe resides on Computer B; Im trying to execute from Computer A; The
> > > account running the script will have the same permissions across the
domain.
> > > Is this whats called interactive execution?
> > >
> > > "Marty List" wrote:
> > >
> > > >
> > > > That depends on where the EXE resides.  Is it on your local machine, on
a
> > > > server, or on each remote system?  Permissions will be an issue if it's
not
> > on
> > > > each remote system's hard drive.
> > > >
> > > >
> > > > "aquel" <aq***@discussions.microsoft.com> wrote in message
> > > > news:D39365CB-0A01-40DC-8D04-21F5EF46C14C@microsoft.com...
> > > > > I have the following script that i want to run on remote machines:
> > > > > On Error Resume Next
> > > > >
> > > > > arrComputers = Array("AVST149")
> > > > >
> > > > > For Each strComputer in arrComputers
> > > > >
> > > > >     Set objWMIService = GetObject _
> > > > >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> > > > >     Set colItems = objWMIService.ExecQuery _
> > > > >         ("Select * From Win32_OperatingSystem")
> > > > >     For Each objItem in ColItems
> > > > >         HOW TO MAKE AN EXE RUN HERE???
> > > > >     Next
> > > > >
> > > > > Next
> > > > >
> > > > > What would be the command to make an exe run on the target computer?
> > > >
> > > >
> > > >
> >
> >
> >
Author
9 Aug 2005 1:17 PM
aquel
Normally, in orer to run some.exe i just double click on the icon and off it
goes

Show quote
"Marty List" wrote:

>
> Are you sure "some.exe" is configured to run silently, with no user input
> (unattended)?
>
>
> "aquel" <aq***@discussions.microsoft.com> wrote in message
> news:E592ADF7-63EC-4881-8DF3-C0DE16321B28@microsoft.com...
> > I composed the following script; it seems to spawn the exe on the remote
> > server but it stays on a hung status; if i check taskmanager i can see the
> > exe sitting there but not doing what its supose to do, any thoughts?
> > On Error Resume Next
> >
> > Const x= "some.exe"
> >
> >
> > If Right(UCase(wscript.FullName), 11) = "WSCRIPT.EXE" Then
> >      wscript.echo "ERROR: You must run this script using cscript, for
> > example 'cscript " & wscript.scriptname & "'."
> >      wscript.quit 0
> > End If
> >
> >
> > ipFile = "RemoteServer"
> > PathToExe = "E:\folder\subFolder\"
> >
> > Set onet = CreateObject("wscript.network")
> > Set ofs = CreateObject("scripting.filesystemobject")
> >
> >
> > ' Make sure to end with a \ character.
> > If Right(PathToExe, 1) <> "\" Then
> >      PathToExe = PathToExe & "\"
> > End If
> >
> > 'Note that cim_datafile does not support UNC paths
> > 'so everything must be handled through mapped drives.
> > If Left(PathToExe, 2) = "\\" Then
> >      wscript.echo "<PathToExe> cannot be a UNC path, please map a drive
> > locally"
> >      wscript.quit
> > End If
> >
> > exeX = ofs.getfile(PathToExe + lifeCare).Name
> >
> > Set osvcLocal = GetObject("winmgmts:root\cimv2")
> >
> > 'The error-handling code is below the function that may throw one - execute
> > it.
> > On Error Resume Next
> >
> > 'While Not oipFile.atEndOfStream
> >
> >      ip = "SOMEIPAddress"
> >      wscript.echo vbCrLf & "Connecting to " & ip & "..."
> >
> >      Err.Clear
> >      Set osvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2")
> >
> >      If (Err.Number <> 0) Then
> >           wscript.echo "Failed to connect to " & ip & "."
> >      Else
> >
> >           wscript.echo "Running some.exe" & "..."
> >   Set oprocess = osvcRemote.Get("win32_process")
> >
> >           ' Run exe without user interaction
> >               ret = oprocess.Create("E:\\folder\\subFolder\\some.exe")
> >               If (ret <> 0) Then
> >                   wscript.echo "Failed to start process on " & ip & ": " & ret
> >                     Else
> >
> >                      wscript.echo "Installation successful."
> >
> >                     End If     'Create process succeeded.
> >
> >      End If ' Do the next IP address, then the next IP address...
> >
> >
> > oipFile.close()
> >
> > wscript.echo vbCrLf & "Run complete. Exiting."
> >
> >
> >
> > "Marty List" wrote:
> >
> > >
> > > One of these should work for you:
> > >
> > > WMI:
> > >
> http://msdn.microsoft.com/library/en-us/wmisdk/wmi/creating_processes_remotely.asp
> > >
> > > WSH:
> > >
> http://msdn.microsoft.com/library/en-us/script56/html/wsconRunningScriptsRemotelyRunningScriptOverThereFromHere.asp
> > >
> http://msdn.microsoft.com/library/en-us/script56/html/wslrfRemote_WSHObject.asp
> > >
> > >
> > > "aquel" <aq***@discussions.microsoft.com> wrote in message
> > > news:6EB07E49-0785-4D00-BC61-5D8D270403EB@microsoft.com...
> > > > The exe resides on Computer B; Im trying to execute from Computer A; The
> > > > account running the script will have the same permissions across the
> domain.
> > > > Is this whats called interactive execution?
> > > >
> > > > "Marty List" wrote:
> > > >
> > > > >
> > > > > That depends on where the EXE resides.  Is it on your local machine, on
> a
> > > > > server, or on each remote system?  Permissions will be an issue if it's
> not
> > > on
> > > > > each remote system's hard drive.
> > > > >
> > > > >
> > > > > "aquel" <aq***@discussions.microsoft.com> wrote in message
> > > > > news:D39365CB-0A01-40DC-8D04-21F5EF46C14C@microsoft.com...
> > > > > > I have the following script that i want to run on remote machines:
> > > > > > On Error Resume Next
> > > > > >
> > > > > > arrComputers = Array("AVST149")
> > > > > >
> > > > > > For Each strComputer in arrComputers
> > > > > >
> > > > > >     Set objWMIService = GetObject _
> > > > > >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> > > > > >     Set colItems = objWMIService.ExecQuery _
> > > > > >         ("Select * From Win32_OperatingSystem")
> > > > > >     For Each objItem in ColItems
> > > > > >         HOW TO MAKE AN EXE RUN HERE???
> > > > > >     Next
> > > > > >
> > > > > > Next
> > > > > >
> > > > > > What would be the command to make an exe run on the target computer?
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
>
>
>
Author
5 Aug 2005 1:29 PM
J Ford
Unless you must code it you might also look at 'psexec' from sysinternals, it
will launch a file remotely on a machine, or copy the file to launch on the
machine.  And, it will give you the ability to choose interactive or not with
different credentials as well.

Or for the scripting side you can take a look at MS Example used to install
patch ms03-039.  http://support.microsoft.com/kb/827227

~Jeremy

Show quote
"aquel" wrote:

> I have the following script that i want to run on remote machines:
> On Error Resume Next
>
> arrComputers = Array("AVST149")
>
> For Each strComputer in arrComputers
>
>     Set objWMIService = GetObject _
>         ("winmgmts:\\" & strComputer & "\root\cimv2")
>     Set colItems = objWMIService.ExecQuery _
>         ("Select * From Win32_OperatingSystem")
>     For Each objItem in ColItems
>         HOW TO MAKE AN EXE RUN HERE???
>     Next
>
> Next
>
> What would be the command to make an exe run on the target computer?
Author
8 Aug 2005 7:45 PM
aquel
Thanks for your reply. I re-engineered the following script from the example
you sent me; it seems to spawn the exe on the remote server but it stays on a
hung status; if i check taskmanager i can see the exe sitting there on the
remote server but not doing what its supose to do, any thoughts?

On Error Resume Next
Const x= "some.exe"
If Right(UCase(wscript.FullName), 11) = "WSCRIPT.EXE" Then
     wscript.echo "ERROR: You must run this script using cscript, for
example 'cscript " & wscript.scriptname & "'."
     wscript.quit 0
End If
ipFile = "RemoteServer"
PathToExe = "E:\folder\subFolder\"

Set onet = CreateObject("wscript.network")
Set ofs = CreateObject("scripting.filesystemobject")
' Make sure to end with a \ character.
If Right(PathToExe, 1) <> "\" Then
     PathToExe = PathToExe & "\"
End If
'Note that cim_datafile does not support UNC paths
'so everything must be handled through mapped drives.
If Left(PathToExe, 2) = "\\" Then
     wscript.echo "<PathToExe> cannot be a UNC path, please map a drive
locally"
     wscript.quit
End If

exeX = ofs.getfile(PathToExe + lifeCare).Name

Set osvcLocal = GetObject("winmgmts:root\cimv2")

'The error-handling code is below the function that may throw one - execute
it.
On Error Resume Next

'While Not oipFile.atEndOfStream

     ip = "SOMEIPAddress"
     wscript.echo vbCrLf & "Connecting to " & ip & "..."

     Err.Clear
     Set osvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2")

     If (Err.Number <> 0) Then
          wscript.echo "Failed to connect to " & ip & "."
     Else

          wscript.echo "Running some.exe" & "..."
      Set oprocess = osvcRemote.Get("win32_process")

          ' Run exe without user interaction
              ret = oprocess.Create("E:\\folder\\subFolder\\some.exe")
              If (ret <> 0) Then
                  wscript.echo "Failed to start process on " & ip & ": " & ret
                    Else

                     wscript.echo "Installation successful."

                    End If     'Create process succeeded.

     End If ' Do the next IP address, then the next IP address...


oipFile.close()

wscript.echo vbCrLf & "Run complete. Exiting."



Show quote
"J Ford" wrote:

> Unless you must code it you might also look at 'psexec' from sysinternals, it
> will launch a file remotely on a machine, or copy the file to launch on the
> machine.  And, it will give you the ability to choose interactive or not with
> different credentials as well.
>
> Or for the scripting side you can take a look at MS Example used to install
> patch ms03-039.  http://support.microsoft.com/kb/827227
>
> ~Jeremy
>
> "aquel" wrote:
>
> > I have the following script that i want to run on remote machines:
> > On Error Resume Next
> >
> > arrComputers = Array("AVST149")
> >
> > For Each strComputer in arrComputers
> >
> >     Set objWMIService = GetObject _
> >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> >     Set colItems = objWMIService.ExecQuery _
> >         ("Select * From Win32_OperatingSystem")
> >     For Each objItem in ColItems
> >         HOW TO MAKE AN EXE RUN HERE???
> >     Next
> >
> > Next
> >
> > What would be the command to make an exe run on the target computer?
Author
8 Aug 2005 8:04 PM
J Ford
When the process launches does it exit on its own, or wait for some
interactive input?

Show quote
"aquel" wrote:

> Thanks for your reply. I re-engineered the following script from the example
> you sent me; it seems to spawn the exe on the remote server but it stays on a
> hung status; if i check taskmanager i can see the exe sitting there on the
> remote server but not doing what its supose to do, any thoughts?
>
> On Error Resume Next
> Const x= "some.exe"
> If Right(UCase(wscript.FullName), 11) = "WSCRIPT.EXE" Then
>      wscript.echo "ERROR: You must run this script using cscript, for
> example 'cscript " & wscript.scriptname & "'."
>      wscript.quit 0
> End If
> ipFile = "RemoteServer"
> PathToExe = "E:\folder\subFolder\"
>
> Set onet = CreateObject("wscript.network")
> Set ofs = CreateObject("scripting.filesystemobject")
> ' Make sure to end with a \ character.
> If Right(PathToExe, 1) <> "\" Then
>      PathToExe = PathToExe & "\"
> End If
> 'Note that cim_datafile does not support UNC paths
> 'so everything must be handled through mapped drives.
> If Left(PathToExe, 2) = "\\" Then
>      wscript.echo "<PathToExe> cannot be a UNC path, please map a drive
> locally"
>      wscript.quit
> End If
>
> exeX = ofs.getfile(PathToExe + lifeCare).Name
>
> Set osvcLocal = GetObject("winmgmts:root\cimv2")
>
> 'The error-handling code is below the function that may throw one - execute
> it.
> On Error Resume Next
>
> 'While Not oipFile.atEndOfStream
>     
>      ip = "SOMEIPAddress"
>      wscript.echo vbCrLf & "Connecting to " & ip & "..."
>
>      Err.Clear
>      Set osvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2")
>
>      If (Err.Number <> 0) Then
>           wscript.echo "Failed to connect to " & ip & "."
>      Else
>
>           wscript.echo "Running some.exe" & "..."
>       Set oprocess = osvcRemote.Get("win32_process")
>
>           ' Run exe without user interaction
>               ret = oprocess.Create("E:\\folder\\subFolder\\some.exe")
>               If (ret <> 0) Then
>                   wscript.echo "Failed to start process on " & ip & ": " & ret
>                     Else
>
>                      wscript.echo "Installation successful."
>
>                     End If     'Create process succeeded.
>          
>      End If ' Do the next IP address, then the next IP address...
>
>
> oipFile.close()
>
> wscript.echo vbCrLf & "Run complete. Exiting."
>
>
>
> "J Ford" wrote:
>
> > Unless you must code it you might also look at 'psexec' from sysinternals, it
> > will launch a file remotely on a machine, or copy the file to launch on the
> > machine.  And, it will give you the ability to choose interactive or not with
> > different credentials as well.
> >
> > Or for the scripting side you can take a look at MS Example used to install
> > patch ms03-039.  http://support.microsoft.com/kb/827227
> >
> > ~Jeremy
> >
> > "aquel" wrote:
> >
> > > I have the following script that i want to run on remote machines:
> > > On Error Resume Next
> > >
> > > arrComputers = Array("AVST149")
> > >
> > > For Each strComputer in arrComputers
> > >
> > >     Set objWMIService = GetObject _
> > >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> > >     Set colItems = objWMIService.ExecQuery _
> > >         ("Select * From Win32_OperatingSystem")
> > >     For Each objItem in ColItems
> > >         HOW TO MAKE AN EXE RUN HERE???
> > >     Next
> > >
> > > Next
> > >
> > > What would be the command to make an exe run on the target computer?
Author
9 Aug 2005 1:19 PM
aquel
No interactive input just goes on its own. If i create a simple vb script to
fire the exe it works locally.

Show quote
"J Ford" wrote:

> When the process launches does it exit on its own, or wait for some
> interactive input?
>
> "aquel" wrote:
>
> > Thanks for your reply. I re-engineered the following script from the example
> > you sent me; it seems to spawn the exe on the remote server but it stays on a
> > hung status; if i check taskmanager i can see the exe sitting there on the
> > remote server but not doing what its supose to do, any thoughts?
> >
> > On Error Resume Next
> > Const x= "some.exe"
> > If Right(UCase(wscript.FullName), 11) = "WSCRIPT.EXE" Then
> >      wscript.echo "ERROR: You must run this script using cscript, for
> > example 'cscript " & wscript.scriptname & "'."
> >      wscript.quit 0
> > End If
> > ipFile = "RemoteServer"
> > PathToExe = "E:\folder\subFolder\"
> >
> > Set onet = CreateObject("wscript.network")
> > Set ofs = CreateObject("scripting.filesystemobject")
> > ' Make sure to end with a \ character.
> > If Right(PathToExe, 1) <> "\" Then
> >      PathToExe = PathToExe & "\"
> > End If
> > 'Note that cim_datafile does not support UNC paths
> > 'so everything must be handled through mapped drives.
> > If Left(PathToExe, 2) = "\\" Then
> >      wscript.echo "<PathToExe> cannot be a UNC path, please map a drive
> > locally"
> >      wscript.quit
> > End If
> >
> > exeX = ofs.getfile(PathToExe + lifeCare).Name
> >
> > Set osvcLocal = GetObject("winmgmts:root\cimv2")
> >
> > 'The error-handling code is below the function that may throw one - execute
> > it.
> > On Error Resume Next
> >
> > 'While Not oipFile.atEndOfStream
> >     
> >      ip = "SOMEIPAddress"
> >      wscript.echo vbCrLf & "Connecting to " & ip & "..."
> >
> >      Err.Clear
> >      Set osvcRemote = GetObject("winmgmts:\\" & ip & "\root\cimv2")
> >
> >      If (Err.Number <> 0) Then
> >           wscript.echo "Failed to connect to " & ip & "."
> >      Else
> >
> >           wscript.echo "Running some.exe" & "..."
> >       Set oprocess = osvcRemote.Get("win32_process")
> >
> >           ' Run exe without user interaction
> >               ret = oprocess.Create("E:\\folder\\subFolder\\some.exe")
> >               If (ret <> 0) Then
> >                   wscript.echo "Failed to start process on " & ip & ": " & ret
> >                     Else
> >
> >                      wscript.echo "Installation successful."
> >
> >                     End If     'Create process succeeded.
> >          
> >      End If ' Do the next IP address, then the next IP address...
> >
> >
> > oipFile.close()
> >
> > wscript.echo vbCrLf & "Run complete. Exiting."
> >
> >
> >
> > "J Ford" wrote:
> >
> > > Unless you must code it you might also look at 'psexec' from sysinternals, it
> > > will launch a file remotely on a machine, or copy the file to launch on the
> > > machine.  And, it will give you the ability to choose interactive or not with
> > > different credentials as well.
> > >
> > > Or for the scripting side you can take a look at MS Example used to install
> > > patch ms03-039.  http://support.microsoft.com/kb/827227
> > >
> > > ~Jeremy
> > >
> > > "aquel" wrote:
> > >
> > > > I have the following script that i want to run on remote machines:
> > > > On Error Resume Next
> > > >
> > > > arrComputers = Array("AVST149")
> > > >
> > > > For Each strComputer in arrComputers
> > > >
> > > >     Set objWMIService = GetObject _
> > > >         ("winmgmts:\\" & strComputer & "\root\cimv2")
> > > >     Set colItems = objWMIService.ExecQuery _
> > > >         ("Select * From Win32_OperatingSystem")
> > > >     For Each objItem in ColItems
> > > >         HOW TO MAKE AN EXE RUN HERE???
> > > >     Next
> > > >
> > > > Next
> > > >
> > > > What would be the command to make an exe run on the target computer?

AddThis Social Bookmark Button