keilamym Posted November 1, 2005 Share Posted November 1, 2005 I was looking to see if Autoit could check for a service to see if its running but I cant lcoate an AutoIt command. In the past, I had psservice export the service list to a text file, then query the text file for the service name. any assistance would be appreciated. Thank You Lavelle Link to comment Share on other sites More sharing options...
BigDod Posted November 1, 2005 Share Posted November 1, 2005 I was looking to see if Autoit could check for a service to see if its running but I cant lcoate an AutoIt command. In the past, I had psservice export the service list to a text file, then query the text file for the service name.any assistance would be appreciated.Thank YouLavelleYou could lookup the DOS command sc Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Confuzzled Posted November 4, 2005 Share Posted November 4, 2005 You could lookup the DOS command sc Depending on what OS version you are running, there should be a WMI call for it. Search for Scriptomatic here in these forums - it will write the code for you! Link to comment Share on other sites More sharing options...
Nuffilein805 Posted November 4, 2005 Share Posted November 4, 2005 how bout $a = processlist (""); maybe you do your service in the quotes for $i = 1 to $a[0][0] step 1 msgbox (0, "Process running", $a[$i][0]) next hope that helps my little chatmy little encryption toolmy little hidermy unsafe clickbot Link to comment Share on other sites More sharing options...
kpu Posted November 4, 2005 Share Posted November 4, 2005 (edited) Here's what I've done to check remote systems and start it. Not pretty, but it does the job. Here's a list of services: browser|TrkWks|ERSvc|helpsvc|CiSvc|dmserver|Netlogon|mnmsrvc|SysmonLog|WmdmPmSN| RSVP|RDSessMgr|RemoteRegistry|seclogon|SamSs|lanmanserver|SCardSvr|SSDPRSRV| srservice|LmHosts|TlntSvr|UPS|upnphost|w32Time|WZCSVC This will: 1. Connect to remote computer. 2. Change the service to Demand 3. Start the service and sleep for a couple seconds 4. Query the service. If the service is pending, it will loop until it's started. 5. Close Connection 6. Exit Here ya go. $service = "TlntSvr";telnet service. Case Sensitive !! $pc = "computer" $pw = "password" ;Connect to remote IPC Share. RunWait(@ComSpec & " /c " & "net use \\" & $pc & "\IPC$ /U:Administrator " & $pw & " > temp.txt", "", @SW_HIDE) ;Set service to Demand (boot|system|auto|demand|disabled) RunWait(@ComSpec & " /c " & "sc \\" & $pc & " config " & $service & " start= demand", "", @SW_HIDE) ;start service RunWait(@ComSpec & " /c " & "sc \\" & $pc & " start " & $service, "", @SW_HIDE) Sleep(2000);Wait for service to start. ;Query service for status RunWait(@ComSpec & " /c " & "sc \\" & $pc & " query " & $service & " > temp.txt", "", @SW_HIDE) $file = FileOpen("temp.txt", 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf While 1 $line = FileReadLine($file, 4) If $line = " STATE : 2 START_PENDING " Then RunWait(@ComSpec & " /c " & "sc \\" & $pc & " query " & $service & " > temp.txt", "", @SW_HIDE) Sleep(1000) ElseIf $line = " STATE : 4 RUNNING " Then MsgBox(32, "Success", "Service Running") Exit Else MsgBox(16,"Warning!","Something Didn't work correctly. Opening Temp File",3) Run("temp.txt") exit EndIf WEnd FileClose($file) ;Close Network session RunWait(@ComSpec & " /c " & "net use" & " \\" & $pc & "\IPC$ /delete", "", @SW_HIDE Edited November 4, 2005 by kpu http://www.kpunderground.com Link to comment Share on other sites More sharing options...
keilamym Posted October 10, 2006 Author Share Posted October 10, 2006 thanks... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now