Thursday, June 3, 2010

Windows Management Instrumentation Command

Windows Management Instrumentation Command.

Read a huge range of information about local or remote computers. Also provides a way to make configuration changes to multiple remote machines.


Syntax
WMIC [global switches] [/locale:ms_409] alias> [options][format]

What is WMIC?

WMIC extends WMI for operation from several command-line interfaces and through batch scripts. Before WMIC, people 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 brief

from 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).

How to Run WMIC

To invoke the WMIC command prompt, type

wmic

in the standard XP or .NET Server command interpreter (cmd.exe), a Telnet session, or the Run dialog box. These startup methods are available locally or through a .NET Server Terminal Services session.

The first time you start WMIC, Windows installs it on the computer and displays the WMIC command prompt, wmic:root\cli>. At this prompt, you enter commands interactively. For example, the command

process where name='outlook.exe' call terminate

closes Microsoft Outlook if it's running. After the command runs, the WMIC command prompt reappears. Note that you must type each command in this article on one line, not split across multiple lines, for the commands to run properly. (Some commands in the tables and listings in this article are split across multiple lines for publication purposes.)

WMIC also runs in noninteractive mode. This mode is especially useful when you need to complete a single task or you need to run WMIC commands in a batch file. To run a command in noninteractive mode, you start WMIC and run the command in the same line of code. For example, you can open a command prompt and type

wmic /node:SERVER1 printer list status

to check the status of printers attached to SERVER1. In this example, WMIC starts, uses the /node switch to establish a remote connection to SERVER1, and runs a command to display printer status information. After the command runs and displays results, the command prompt reappears.

You can remotely access any WMI-enabled computer from any computer running WMIC. The computer you want to access doesn't require WMIC. For example, you can start WMIC from a computer running XP Professional Edition to manage a mix of computers running XP, Win2K, Windows NT 4.0, Windows Me, and Windows 9x.


WMIC Command-Line Components

WMIC uses global switches, aliases, verbs, commands, and command-line help to empower the interface. Global switches are settings that apply to and for the entire WMIC session. For example, the /trace:on switch enables error tracing. While this switch is on, WMIC returns error information for every command you execute. The /node switch lets you access a remote computer. The /interactive:on switch ensures that WMIC prompts you for confirmation before performing delete operations. Other global switches include /role, /user, /implevel, and /namespace.


Reference link

http://msdn.microsoft.com/en-us/library/Aa394572

http://msdn.microsoft.com/en-us/library/aa394531%28VS.85%29.aspx

http://support.microsoft.com/servicedesks/webcasts/wc072402/listofsampleusage.asp

http://ss64.com/nt/wmic.html




No comments:

Post a Comment

Your feedback is always appreciated. I will try to reply to your queries as soon as time allows.Please don't spam,spam comments will be deleted upon reviews.