RE: remote scripting how to
- From: "aquel" <aquel@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 9 Aug 2005 06:19:03 -0700
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?
.
- References:
- remote scripting how to
- From: aquel
- RE: remote scripting how to
- From: J Ford
- RE: remote scripting how to
- From: aquel
- RE: remote scripting how to
- From: J Ford
- remote scripting how to
- Prev by Date: Re: remote scripting how to
- Next by Date: Logon script
- Previous by thread: RE: remote scripting how to
- Next by thread: Hybernation on laptops
- Index(es):
Relevant Pages
|