Enumerating Management Objects
- DirectoryObjectSearcher obj - to programatically access resources ~ WMI.
- mimics SQL.
- To execute query:
1. ConnectionOptions (UserName, Password). 2. instance of DirectoryObjectSearcher, 3. Instance of ManagementScope obj - set path 4. Instance of ObjectQuery obj., 5. ManagementObjectCollection = DirectoryObjectSearcher.Get() - enumerating logical drives - specify target - e.g. Win32_LogicalDisk.
- enumerating network adapters - Win32_NetworkConfiguration - new ManagemmentObjectSearcher("SELECT * FRO MWin32_NetworkConfiguration");
- enumerating windows services - Win32_Service - ManagementObjectCollection AllObjects = DemoSearcher.Get();
No comments:
Post a Comment