Find out if swremote is running?
Posted: Wed Sep 30, 2009 2:27 pm
Is there a way for Housebot to know if a swremote is running? I want a task to start the swremote if it has been closed for a certain time...
Home Automation for the Automation Enthusiast
https://housebot.com/forums/
Code: Select all
a=GetObject("winmgmts:\\" & (Remote_Computer) & "\root\cimv2:Win32_Process").Create("Path_to_SWREMOTE", null, null, intProcessID)
Code: Select all
Function IsProcessRunning( strServer, strProcess )
Dim Process, strObject
IsProcessRunning = False
strObject = "winmgmts://" & strServer
For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
If UCase( Process.name ) = UCase( strProcess ) Then
IsProcessRunning = True
Exit Function
End If
Next
End Function
Dim strComputer, strProcess
Do
strProcess = inputbox( "Please enter the name of the process (for instance: notepad.exe)", "Input" )
Loop until strProcess <> ""
Do
strComputer = inputbox( "Please enter the computer name", "Input" )
Loop until strComputer <> ""
If( IsProcessRunning( strComputer, strProcess ) = True ) Then
WScript.Echo "Process " & strProcess & " IS running on computer " & strComputer
Else
WScript.Echo "Process " & strProcess & " is NOT running on computer " & strComputer
End If
Code: Select all
Dim Process, strObject
strObject = "winmgmts://kontrollpc"
For Each Process in GetObject( strObject ).InstancesOf( "win32_process" )
If UCase( Process.name ) = UCase( "swremote.exe" ) Then
isrunning="yes"
End If
Next
if isrunning="yes" then
else
set objShell=CreateObject("Wscript.Shell")
objShell.Run("c:\\program\swremote\swremote.exe")
end if
SetPropertyValue "Timer kolla om swremote är igång.Running", "Yes"