Soldato
- Joined
- 16 May 2008
- Posts
- 2,579
- Location
- Bristol
Hi,
I'm writing some batch files, one of which starts an application on a list of IPs.
Currently I am using this workaround:
This schedules a task to run the program 2 minutes in the future and is quite lame. What I would like is a VBS solution which eliminates the 2minute delay but have no experience in VB script..
I found this:
But it does not account for login credentials. Please could someone advise how to add this functionality?
I'm writing some batch files, one of which starts an application on a list of IPs.
Currently I am using this workaround:
set h=%TIME:~0,2%
set m=%TIME:~3,2%
set s=%TIME:~6,2%
IF [%m%]==[] SET /a m=02 GOTO settime
IF %m%==58 SET /a m=00 GOTO settime
IF %m%==59 SET /a m=01 GOTO settime
IF %m%==60 SET /a m=02 GOTO settime
set /a m=(m+2)
:settime
set time2=%h%:%m%:%s%
FOR /f %%f in (ips.txt) do (
start schtasks /create /tn "run this program" /ru Administrator /rp Password /tr C:\program.exe /s \\%%f /sc once /sd %date% /st %time2%
)
This schedules a task to run the program 2 minutes in the future and is quite lame. What I would like is a VBS solution which eliminates the 2minute delay but have no experience in VB script..
I found this:
strComputer = InputBox("What computer or IP do you want to use?")
strProg = InputBox("What Program do you want to start?")
Set objWMIService = GetObject _
("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
Error = objWMIService.Create(strProg, null, null, intProcessID)
If Error = 0 Then
Wscript.Echo "Your application was started with a process ID of " _
& intProcessID & "."
Else
Wscript.Echo "Your application could not be started due to error " & _
Error & "."
End If
But it does not account for login credentials. Please could someone advise how to add this functionality?