Re: remote scripting how to
- From: "aquel" <aquel@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 9 Aug 2005 06:17:01 -0700
Normally, in orer to run some.exe i just double click on the icon and off it
goes
"Marty List" wrote:
>
> Are you sure "some.exe" is configured to run silently, with no user input
> (unattended)?
>
>
> "aquel" <aquel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:E592ADF7-63EC-4881-8DF3-C0DE16321B28@xxxxxxxxxxxxxxxx
> > 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" <aquel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > news:6EB07E49-0785-4D00-BC61-5D8D270403EB@xxxxxxxxxxxxxxxx
> > > > 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" <aquel@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > > > news:D39365CB-0A01-40DC-8D04-21F5EF46C14C@xxxxxxxxxxxxxxxx
> > > > > > 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: Marty List
- Re: remote scripting how to
- From: aquel
- Re: remote scripting how to
- From: Marty List
- Re: remote scripting how to
- From: aquel
- Re: remote scripting how to
- From: Marty List
- remote scripting how to
- Prev by Date: Re: how could I get all the computer name in a group which are running?
- Next by Date: RE: remote scripting how to
- Previous by thread: Re: remote scripting how to
- Next by thread: RE: remote scripting how to
- Index(es):