This article is from the March 2002 issue of Windows & .NET Magazine.Microsoft is creating a lot of good reasons to make the command prompt in Windows XP and the Windows Server 2003 family your home for systems management. Windows Management Instrumentation Command-line (WMIC), which uses the power of Windows Management Instrumentation (WMI) to enable systems management from the command line, is one of those reasons. WMI has been an important part of Microsoft's systems management initiative since Microsoft Systems Management Server (SMS) 2.0 and has grown in popularity since the introduction of Windows 2000. However, until the introduction of WMIC, you couldn't easily access the WMI repository or the WMI namespace from a command prompt. On This PageWhat Is WMIC?
How to Run WMIC
WMIC Command-Line Components
Putting WMIC to Work
What Is WMIC?WMIC extends WMI for operation from several command-line interfaces and through batch scripts. Before WMIC, you used WMI-based applications (such as SMS), the WMI Scripting API, or tools such as CIM Studio to manage WMI-enabled computers. Without a firm grasp on a programming language such as C++ or a scripting language such as VBScript and a basic understanding of the WMI namespace, do-it-yourself systems management with WMI was difficult. WMIC changes this situation by giving you a powerful, user-friendly interface to the WMI namespace. WMIC is more intuitive than WMI, in large part because of aliases. Aliases take simple commands that you enter at the command line, then act upon the WMI namespace in a predefined way, such as constructing a complex WMI Query Language (WQL) command from a simple WMIC alias Get command. Thus, aliases act as friendly syntax intermediaries between you and the namespace. For example, when you run a simple WMIC command such as useraccount list brieffrom the WMIC command prompt to get user account information, the Useraccount alias performs a WQL query of the Win32_Useraccount class and displays specific data from this class in text format. WMIC also displays the Win32_Useraccount class's properties at the console in text format. WMIC can return the results of a command in other formats, such as XML, HTML, and Comma Separated Value (CSV). WMIC stores aliases as instances of a class in the WMI schema. The default alias classMSFT_CliAlias—and other classes that support WMIC are stored in the schema's default namespace, or role—root\cli. Think of a role as simply another WMI namespace that's specifically designed to support WMIC. The default role, root\cli, connects to the root\cimv2 namespace to operate on the classes within root\cimv2. You won't typically use CIM Studio when you run WMIC, but you can use CIM Studio to find the root\cli namespace in a list of WMI namespaces. Figure 1 shows the root\cli node and some of the properties in the MSFT_CliAlias class.
Read more: TechNet
How to Run WMIC
WMIC Command-Line Components
Putting WMIC to Work
What Is WMIC?WMIC extends WMI for operation from several command-line interfaces and through batch scripts. Before WMIC, you used WMI-based applications (such as SMS), the WMI Scripting API, or tools such as CIM Studio to manage WMI-enabled computers. Without a firm grasp on a programming language such as C++ or a scripting language such as VBScript and a basic understanding of the WMI namespace, do-it-yourself systems management with WMI was difficult. WMIC changes this situation by giving you a powerful, user-friendly interface to the WMI namespace. WMIC is more intuitive than WMI, in large part because of aliases. Aliases take simple commands that you enter at the command line, then act upon the WMI namespace in a predefined way, such as constructing a complex WMI Query Language (WQL) command from a simple WMIC alias Get command. Thus, aliases act as friendly syntax intermediaries between you and the namespace. For example, when you run a simple WMIC command such as useraccount list brieffrom the WMIC command prompt to get user account information, the Useraccount alias performs a WQL query of the Win32_Useraccount class and displays specific data from this class in text format. WMIC also displays the Win32_Useraccount class's properties at the console in text format. WMIC can return the results of a command in other formats, such as XML, HTML, and Comma Separated Value (CSV). WMIC stores aliases as instances of a class in the WMI schema. The default alias classMSFT_CliAlias—and other classes that support WMIC are stored in the schema's default namespace, or role—root\cli. Think of a role as simply another WMI namespace that's specifically designed to support WMIC. The default role, root\cli, connects to the root\cimv2 namespace to operate on the classes within root\cimv2. You won't typically use CIM Studio when you run WMIC, but you can use CIM Studio to find the root\cli namespace in a list of WMI namespaces. Figure 1 shows the root\cli node and some of the properties in the MSFT_CliAlias class.
Read more: TechNet
0 comments:
Post a Comment