Sunsawe Posted September 18, 2007 Share Posted September 18, 2007 Hi, A lot of people is using the wmi service. Usually it looks like that: Func _ServGetDetails($iName, $Computer = ".") Local $Rtn = '' $Service = ObjGet("winmgmts:\\" & $Computer & "\root\cimv2") $sItems = $Service.ExecQuery("Select * from Win32_Service") For $objService in $sItems If $objService.Name == $iName Then $Rtn &= $objService.SystemName & '|' & $objService.Name & '|' & $objService.ServiceType & '|' & $objService.State & '|' $Rtn &= $objService.ExitCode & '|' & $objService.ProcessID & '|' & $objService.AcceptPause & '|' & $objService.AcceptStop & '|' $Rtn &= $objService.Caption & '|' & $objService.Description & '|' & $objService.DesktopInteract & '|' & $objService.DisplayName & '|' $Rtn &= $objService.ErrorControl & '|' & $objService.PathName & '|' &$objService.Started & '|' & $objService.StartMode & '|' $Rtn &= $objService.StartName Return StringSplit($Rtn, '|') EndIf Next Return SetError(-1) EndFunc I would like to know if there is a way to "explore" the $objService without knowing its attributs. Something like: foreach $attribut in $objService $attribut.getName() $attribut.getValue() Thanks Link to comment Share on other sites More sharing options...
James Posted September 19, 2007 Share Posted September 19, 2007 Have you tried Default? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
ptrex Posted September 19, 2007 Share Posted September 19, 2007 @All There is way if you use a COM Object Browser that accesses the Type Lib. If I have the time I will create one. regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
James Posted September 19, 2007 Share Posted September 19, 2007 ptrex, that would be far over useful, it would be another fantastic script which will help so many people. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Bucione Posted October 23, 2007 Share Posted October 23, 2007 (edited) If I understood your question correctly, this should do the trick... Func _EnumWMIclassInstances($classname, $servername = ".") Local $service = ObjGet("winmgmts:\\" & $servername & "\root\cimv2") Local $security = $service.Security_ $security.ImpersonationLevel = 3 Local $collection = $service.InstancesOf($classname) For $object In $collection For $property in $object.Properties_ ConsoleWrite($property.Name & ": " & $property.Value & @CR) Next Next EndFunc _EnumWMIclassInstances("Win32_Service") Edited October 23, 2007 by ArthurB ---------Arthur B Link to comment Share on other sites More sharing options...
GaryFrost Posted October 23, 2007 Share Posted October 23, 2007 why don't you all look at scriptomatic for AutoIt and see how it's done..... Look in Downloads SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
DirtDBaK Posted October 23, 2007 Share Posted October 23, 2007 (edited) i say scriptomatic is the tool you're probabbly looking for. btw there are auotit tags that actually highlight you're script... Edited October 23, 2007 by DBak [center][/center] 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