RE: remote scripting how to



No interactive input just goes on its own. If i create a simple vb script to
fire the exe it works locally.

"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?
.



Relevant Pages

  • RE: remote scripting how to
    ... I re-engineered the following script from the example ... if i check taskmanager i can see the exe sitting there on the ... remote server but not doing what its supose to do, ... > will launch a file remotely on a machine, or copy the file to launch on the ...
    (microsoft.public.windows.server.scripting)
  • RE: remote scripting how to
    ... if i check taskmanager i can see the exe sitting there on the ... > remote server but not doing what its supose to do, ... >> will launch a file remotely on a machine, or copy the file to launch on the ...
    (microsoft.public.windows.server.scripting)
  • Re: convert VB script code to vb (cheap & dirty)
    ... an exe, there are other "cheap-and-dirty" ways to do it. ... of the compiler, the runtime, your script and a little ... the compiler, the runtime and your source code into temporary ... running your vbs with wscript). ...
    (microsoft.public.scripting.vbscript)
  • Re: exe file
    ... "Train my users"? ... An EXE, ... than a VBS script at doing just about anything. ... to convey the general difference between compiled code ...
    (microsoft.public.scripting.vbscript)
  • Re: Cross Site Scripting for .exe?
    ... How can an exe take in these ... > number and no other info...How do i find out if my script has been ... The error message thrown probably, depending on method, does ... webserver input file input file from the DB checked for other keyword ...
    (alt.computer.security)