Using the WMI Explorer to locate a WMI class in Visual Basic .NET

Generator Data Matrix 2d barcode in Visual Basic .NET Using the WMI Explorer to locate a WMI class

Using the WMI Explorer to locate a WMI class
Printing DataMatrix In Visual Basic .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create Data Matrix 2d barcode image in .NET applications.
www.OnBarcode.com
DataMatrix Recognizer In VB.NET
Using Barcode scanner for .NET framework Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Tackling Windows Management Instrumentation
Encoding Matrix In Visual Basic .NET
Using Barcode creation for .NET framework Control to generate, create 2D image in .NET applications.
www.OnBarcode.com
Creating Barcode In Visual Basic .NET
Using Barcode drawer for .NET framework Control to generate, create Barcode image in VS .NET applications.
www.OnBarcode.com
that s a core part of the operating system, so I started in the root\CIMV2 class, shown in the tree view on the left side of the WMI Explorer. Clicking the namespace brings up a list of its classes in the right side, and I took a guess on Desktop as a keyword. Scrolling to the right, I eventually found Win32_Desktop and clicked on that. Doing so enables the details pane at the bottom, and I clicked on the Properties tab to see what was available. About a third of the way down, I found IconSpacing, which is listed as an integer. Here s the trick that most people forget: once you ve found a class and the property or properties you want, click on the Instances tab. There, as shown in figure 11.2, I can see that there are several instances for this class. It looks as if there s one instance for each user account on the computer, in fact. That makes sense, because each user will have their own desktop configuration, and each might select a different icon spacing setting. So when I query this, I ll either need to specify the exact instance I want, or I ll need to get all of the instances and then decide which one s icon spacing matters to me. Obviously, search engines are another good way to find the class you want. I tend to prefix queries with wmi, as in wmi icon spacing, and that will often pull up an
Code 128 Code Set A Encoder In Visual Basic .NET
Using Barcode drawer for .NET Control to generate, create Code128 image in Visual Studio .NET applications.
www.OnBarcode.com
UCC - 12 Encoder In VB.NET
Using Barcode drawer for Visual Studio .NET Control to generate, create UCC - 12 image in Visual Studio .NET applications.
www.OnBarcode.com
Reviewing the available instances for the Win32_Desktop class
Printing UPC Code In Visual Basic .NET
Using Barcode creator for Visual Studio .NET Control to generate, create Universal Product Code version A image in .NET applications.
www.OnBarcode.com
Code 2 Of 5 Printer In Visual Basic .NET
Using Barcode generator for Visual Studio .NET Control to generate, create C 2 of 5 image in VS .NET applications.
www.OnBarcode.com
Using Get-WmiObject
ECC200 Maker In None
Using Barcode generation for Online Control to generate, create Data Matrix 2d barcode image in Online applications.
www.OnBarcode.com
Data Matrix Reader In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
www.OnBarcode.com
example or two that points me in the right direction. The example might be VBScript-related, or might even be in a .NET language like C# or Visual Basic, but that s okay because I m only after the WMI class name. For example, I just searched for wmi icon spacing and turned up http://stackoverflow.com/questions/202971/ formula-or-api-for-calculating-desktop-icon-spacing-on-windows-xp as the first result. On that page I found some C# code:
Encoding Code 39 Full ASCII In .NET Framework
Using Barcode creation for ASP.NET Control to generate, create Code 3 of 9 image in ASP.NET applications.
www.OnBarcode.com
Creating Barcode In Java
Using Barcode printer for Android Control to generate, create Barcode image in Android applications.
www.OnBarcode.com
ManagementObjectSearcher searcher = new ManagementObjectSearcher ("root\\CIMV2","SELECT * FROM Win32_Desktop");
EAN / UCC - 13 Drawer In .NET
Using Barcode generation for Reporting Service Control to generate, create EAN13 image in Reporting Service applications.
www.OnBarcode.com
PDF 417 Printer In None
Using Barcode encoder for Office Word Control to generate, create PDF417 image in Office Word applications.
www.OnBarcode.com
I ve no idea what any of that means, but Win32_Desktop looks like a WMI class name. My next search will be for that class name, as such a search will often turn up whatever documentation may exist. I ll cover the documentation a bit later in this chapter.
PDF-417 2d Barcode Encoder In Java
Using Barcode maker for Android Control to generate, create PDF417 image in Android applications.
www.OnBarcode.com
Make Barcode In C#.NET
Using Barcode maker for VS .NET Control to generate, create Barcode image in Visual Studio .NET applications.
www.OnBarcode.com
11.5 Using Get-WmiObject
Create Quick Response Code In None
Using Barcode maker for Software Control to generate, create QR Code 2d barcode image in Software applications.
www.OnBarcode.com
DataMatrix Creation In Objective-C
Using Barcode creator for iPad Control to generate, create Data Matrix image in iPad applications.
www.OnBarcode.com
PowerShell only makes you learn a single cmdlet to retrieve anything you want from WMI: Get-WmiObject. With it, you can specify a namespace, a class name, and even the name of a remote computer and alternative credentials, if needed to retrieve all instances of that class from the computer specified. You can even provide filter criteria if you want fewer than all of the instances of the class. You can get a list of classes from a namespace. Here s the syntax for that:
Barcode Drawer In None
Using Barcode printer for Office Word Control to generate, create Barcode image in Word applications.
www.OnBarcode.com
Barcode Printer In Visual Studio .NET
Using Barcode maker for Reporting Service Control to generate, create Barcode image in Reporting Service applications.
www.OnBarcode.com
Get-WmiObject -namespace root\cimv2 -list
Note that namespace names use a backslash, not a forward slash. To retrieve a class, specify the namespace and class name:
Get-WmiObject -namespace root\cimv2 -class win32_desktop
The root\CIMv2 namespace is the system default namespace on Windows XP Service Pack 2 and later, so if your class is in that namespace, you don t need to specify it. Also, the -class parameter is positional, so if you provide the class name in the first position, the cmdlet will work exactly the same. Here are two examples, including one that uses the Gwmi alias instead of the full cmdlet name:
PS C:\> Get-WmiObject win32_desktop PS C:\> gwmi antivirusproduct -namespace root\securitycenter
TRY IT NOW You should start following along at this point, running each of
the commands I show you. For commands that include a remote computer name, you can substitute localhost if you don t have another remote computer that you can test against. For many WMI classes, PowerShell has configuration defaults that specify which properties are shown. Win32_OperatingSystem is a good example because it only displays six of its properties, in a list, by default. Keep in mind that you can always pipe the
Copyright © OnBarcode.com . All rights reserved.