rudi Posted October 22, 2007 Share Posted October 22, 2007 Hello,running services I can list withnet startbut then I will need to work with a spool file to process the list.Is there a direct way to get a list of the current settings of all installed services directly?service nameservice's exe file and it's locationservice startup typecurrent service status (running, stopped, starting, stopping)service dependencies?Thanks for any suggestions,regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
SadBunny Posted October 22, 2007 Share Posted October 22, 2007 Check out http://www.autoitscript.com/forum/index.php?showtopic=29404In general, for questions like this, http://www.autoitscript.com/forum/index.ph...=45167&st=0 is a very useful thread.Cheers! Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
weaponx Posted October 22, 2007 Share Posted October 22, 2007 You could roll your own with WMI. This example includes way more than you need though. expandcollapse popup; Generated by AutoIt Scriptomatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "AcceptPause: " & $objItem.AcceptPause & @CRLF $Output = $Output & "AcceptStop: " & $objItem.AcceptStop & @CRLF $Output = $Output & "Caption: " & $objItem.Caption & @CRLF $Output = $Output & "CheckPoint: " & $objItem.CheckPoint & @CRLF $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output = $Output & "Description: " & $objItem.Description & @CRLF $Output = $Output & "DesktopInteract: " & $objItem.DesktopInteract & @CRLF $Output = $Output & "DisplayName: " & $objItem.DisplayName & @CRLF $Output = $Output & "ErrorControl: " & $objItem.ErrorControl & @CRLF $Output = $Output & "ExitCode: " & $objItem.ExitCode & @CRLF $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "PathName: " & $objItem.PathName & @CRLF $Output = $Output & "ProcessId: " & $objItem.ProcessId & @CRLF $Output = $Output & "ServiceSpecificExitCode: " & $objItem.ServiceSpecificExitCode & @CRLF $Output = $Output & "ServiceType: " & $objItem.ServiceType & @CRLF $Output = $Output & "Started: " & $objItem.Started & @CRLF $Output = $Output & "StartMode: " & $objItem.StartMode & @CRLF $Output = $Output & "StartName: " & $objItem.StartName & @CRLF $Output = $Output & "State: " & $objItem.State & @CRLF $Output = $Output & "Status: " & $objItem.Status & @CRLF $Output = $Output & "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output = $Output & "SystemName: " & $objItem.SystemName & @CRLF $Output = $Output & "TagId: " & $objItem.TagId & @CRLF $Output = $Output & "WaitHint: " & $objItem.WaitHint & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop ;Seperate message box for each service ;$Output="" ;One big message $Output &= @CRLF Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_Service" ) Endif Func WMIDateStringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & _ StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _ & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2)) EndFunc Link to comment Share on other sites More sharing options...
rudi Posted October 23, 2007 Author Share Posted October 23, 2007 Thanks to both of you. That's very close to what I was looking for! Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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