Ontosy Posted January 12, 2013 Posted January 12, 2013 I not find a function to get the Service Get StartType. Do exit?
KaFu Posted January 12, 2013 Posted January 12, 2013 (edited) Did you mean StartMode? expandcollapse popup; Generated by AutoIt Scriptomatic January 13, 2013 $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output &= "Computer: " & $strComputer & @CRLF $Output &= "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output &= "AcceptPause: " & $objItem.AcceptPause & @CRLF $Output &= "AcceptStop: " & $objItem.AcceptStop & @CRLF $Output &= "Caption: " & $objItem.Caption & @CRLF $Output &= "CheckPoint: " & $objItem.CheckPoint & @CRLF $Output &= "CreationClassName: " & $objItem.CreationClassName & @CRLF $Output &= "Description: " & $objItem.Description & @CRLF $Output &= "DesktopInteract: " & $objItem.DesktopInteract & @CRLF $Output &= "DisplayName: " & $objItem.DisplayName & @CRLF $Output &= "ErrorControl: " & $objItem.ErrorControl & @CRLF $Output &= "ExitCode: " & $objItem.ExitCode & @CRLF $Output &= "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF $Output &= "Name: " & $objItem.Name & @CRLF $Output &= "PathName: " & $objItem.PathName & @CRLF $Output &= "ProcessId: " & $objItem.ProcessId & @CRLF $Output &= "ServiceSpecificExitCode: " & $objItem.ServiceSpecificExitCode & @CRLF $Output &= "ServiceType: " & $objItem.ServiceType & @CRLF $Output &= "Started: " & $objItem.Started & @CRLF $Output &= "StartMode: " & $objItem.StartMode & @CRLF $Output &= "StartName: " & $objItem.StartName & @CRLF $Output &= "State: " & $objItem.State & @CRLF $Output &= "Status: " & $objItem.Status & @CRLF $Output &= "SystemCreationClassName: " & $objItem.SystemCreationClassName & @CRLF $Output &= "SystemName: " & $objItem.SystemName & @CRLF $Output &= "TagId: " & $objItem.TagId & @CRLF $Output &= "WaitHint: " & $objItem.WaitHint & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" 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 Edit: Here's another WMI query which contains a "StartType", but sadly this query does not finish for me... expandcollapse popup; Generated by AutoIt Scriptomatic January 13, 2013 $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $Output="" $Output &= "Computer: " & $strComputer & @CRLF $Output &= "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ServiceSpecification", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then For $objItem In $colItems $Output &= "Caption: " & $objItem.Caption & @CRLF $Output &= "CheckID: " & $objItem.CheckID & @CRLF $Output &= "CheckMode: " & $objItem.CheckMode & @CRLF $Output &= "Dependencies: " & $objItem.Dependencies & @CRLF $Output &= "Description: " & $objItem.Description & @CRLF $Output &= "DisplayName: " & $objItem.DisplayName & @CRLF $Output &= "ErrorControl: " & $objItem.ErrorControl & @CRLF $Output &= "ID: " & $objItem.ID & @CRLF $Output &= "LoadOrderGroup: " & $objItem.LoadOrderGroup & @CRLF $Output &= "Name: " & $objItem.Name & @CRLF $Output &= "Password: " & $objItem.Password & @CRLF $Output &= "ServiceType: " & $objItem.ServiceType & @CRLF $Output &= "SoftwareElementID: " & $objItem.SoftwareElementID & @CRLF $Output &= "SoftwareElementState: " & $objItem.SoftwareElementState & @CRLF $Output &= "StartName: " & $objItem.StartName & @CRLF $Output &= "StartType: " & $objItem.StartType & @CRLF $Output &= "TargetOperatingSystem: " & $objItem.TargetOperatingSystem & @CRLF $Output &= "Version: " & $objItem.Version & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ServiceSpecification" ) Endif Edited January 12, 2013 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2025-May-18) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
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