Partager via


WMIC switches

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

WMIC switches

Global switches are used to set defaults for the WMIC environment. You can view the current value of the conditions that the global switches set by entering the CONTEXT command.

Switch Condition Possible values Default

/NAMESPACE

The namespace that the aliases typically use

Any namespace

root\cimv2

/ROLE

The namespace that WMIC typically looks in for aliases and other WMIC information. When the role changes, the WMIC interactive command prompt changes to match the role. WMIC only has one role by default (\\root\cli), so you only have switch roles if you have a management product that has defined other roles, or if other roles have been created at your organization.

Any namespace that contains aliases.

root\cli

/NODE

Computer names, comma delimited. All commands are synchronously executed against all computers listed in this value. File names must be prefixed with '@'. Computer names within a file must be comma-delimited, or put on separate lines, or both.

Any computer name, a list of computer names, or a file with computer names in it.

Local computer name

/IMPLEVEL

Impersonation level

Anonymous, Identify, Impersonate, Delegate

Impersonate

/AUTHLEVEL

Authentication level

Default, None, Connect, Call, Pkt, Pktintegrity, Pktprivacy

Pktprivacy

/LOCALE

Locale

MS_409 (English), MS_411 (Japanese), MS_40B (Finnish), and so on.

The default language on the computer when WMIC is installed.

/PRIVILEGES

Enable all privileges.

ENABLE or DISABLE

Enabled

/TRACE

The success or failure of all functions used to execute WMIC commands is displayed.

ON or OFF

Off

/RECORD

Records all output to an XML file. Output is also displayed at the command prompt.

File name

Not set and no default file name exists.

/INTERACTIVE

Typically, delete commands are confirmed.

ON or OFF

OFF in NON-INTERACTIVE mode; ON in INTERACTIVE mode

/FAILFAST

Whether or not the /NODE computers are checked before trying to execute the WMIC commands against them. When FAILFAST is ON, WMIC pings the computers in the /NODE switch before sending WMIC commands to them. If they do not respond to the ping, the WMIC commands are not executed for them.

ON or OFF

OFF

/USER

A user name to be used by WMIC when accessing the /NODE computers or computers specified in aliases. You are prompted for the password. A user name cannot be used with a local computer.

Any user name.

Not set

/PASSWORD

A password to be used by WMIC when accessing the /NODE computers (possibly including the local computer). The password is visible at the command line.

Any password

Not set

/OUTPUT

Specifies a mode for output redirection. All output is directed to the destination given only. Output does not appear at the command line. The destination is cleared before the output begins.

STDOUT, CLIPBOARD, or a file name. STDOUT is the command line. Clipboard is the Windows clipboard. The output can then be pasted to any program that accepts data in the format produced. For more details, see the following note.

STDOUT

/APPEND

Specifies a mode for output redirection. All output is directed to the destination given only. Output does not appear at the command line. The destination is not cleared before the output begins. The new output is appended to the current contents of the destination.

STDOUT, CLIPBOARD, or a file name. STDOUT is the command line. Clipboard is the Windows clipboard. The output can then be pasted to any program that accepts data in the format produced. See the following note for more details.

STDOUT

/AGGREGATE

Used with the LIST and GET/EVERY switch. If AGGREGATE is ON, LIST and GET display their results when all computers in the NODE property have either responded or timed out. If AGGREGATE is OFF, LIST and GET display their results as soon as they are received.

ON or OFF

ON

/AUTHORITY

Specifies the authority type for the connection.

Needed if the value assigned to the IMPLEVEL switch is Delegate (for example, /IMPELEVEL:Delegate). It contains the authority definition string: "kerberos:TargetDomainName\TargetComputerName". For this setting to succeed, computers need to have trust for delegation enabled on the Domain Controller.

Not set

Switch Example

/NAMESPACE

/NAMESPACE:\\root or /NAMESPACE:SMS

/ROLE

/ROLE:\\root

/NODE

/NODE:"TESTSERVER1","TESTSERVER2",@"C:\COMPUTERLIST.TXT"

/IMPLEVEL

/IMPLEVEL:Impersonate

/AUTHLEVEL

/AUTHLEVEL:default

/LOCALE

/LOCALE:MS_411

/PRIVILEGES

/PRIVILEGES:ENABLE

/TRACE

/TRACE:ON

/RECORD

/RECORD:output.xml

/INTERACTIVE

/INTERACTIVE:ON

/FAILFAST

/FAILFAST:ON

/USER

/USER:JSMITH or /USER:"" (to reset the user name and password to nothing).

/PASSWORD

/PASSWORD:PASSWORD

/OUTPUT

/OUTPUT:CLIPBOARD

/APPEND

/APPEND:CLIPBOARD

/AGGREGATE

/AGGREGATE:OFF

/AUTHORITY

/AUTHORITY:"kerberos:TargetDomainName\TargetComputerName"

Notes

  • To browse for possible ROLE and NAMESPACE namespaces, use the command WMIC PATH __NAMESPACE. To see available namespaces in other namespaces, use the /NAMESPACE switch to change a target namespace. For example, use /NAMESPACE:\\root to change the ROOT namespace.

  • The GET, LIST, and ASSOC verbs have WMIC verbs.

  • The /APPEND and /OUTPUT switches can contradict each other (indicating that the results should be sent to different places). When they do contradict each other, /OUTPUT predominates in all cases except where /APPEND is directing the results to a file. In that case, the results go to both the /OUTPUT and /APPEND destinations.

  • Switches can be used on the same line as commands. For example, you can use /NODE:"SERVER1" SERVICE to get a list of all services on SERVER1. The /NODE switch works as described above, and all subsequent commands are also applied to SERVER1. However, if /OUTPUT and /APPEND are used on the same line as a command, the results redirection specified by /OUTPUT and /APPEND only apply to that command. The results of subsequent commands are directed to the previous value of the OUTPUT and APPEND switches.

  • To reset a switch, set its value to "". For example: /NODE:""  sets NODE back to the current computer name.

For more information, see Windows Management Instrumentation Command-line.