datas2k Posted January 15, 2009 Posted January 15, 2009 Hi!My quaestion is how im count the number of existing services ?$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") $Services = $objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", BitOR(0x10,0x20)) ConsoleWrite ("----------------------" & @LF & UBound($Services) & @LF & "----------------------" & @LF)Im ask that cus after getting the services list, counting with UBound not work, always get a zero value.For example with that loop im can count: For $objItem In $Services $i = $i+1 Next.... but im think it is an ugly method.
azure Posted January 15, 2009 Posted January 15, 2009 Hi! My quaestion is how im count the number of existing services ? $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") $Services = $objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", BitOR(0x10,0x20)) ConsoleWrite ("----------------------" & @LF & UBound($Services) & @LF & "----------------------" & @LF)Im ask that cus after getting the services list, counting with UBound not work, always get a zero value. For example with that loop im can count: For $objItem In $Services $i = $i+1 Next .... but im think it is an ugly method. $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colProcessList = $objWMIService.ExecQuery("Select * from Win32_Service") ConsoleWrite($colProcessList.Count & " services found.") For $objProcess In $colProcessList ConsoleWrite($objProcess.Name) Next
datas2k Posted January 15, 2009 Author Posted January 15, 2009 $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colProcessList = $objWMIService.ExecQuery("Select * from Win32_Service") ConsoleWrite($colProcessList.Count & " services found.") For $objProcess In $colProcessList ConsoleWrite($objProcess.Name) Next ah thx im a newb in autoit
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