WMIC

From Help
Jump to: navigation, search

The Windows Management Instrumentation Command-line (WMIC) is a command-line and scripting interface that simplifies the use of Windows Management Instrumentation (WMI) and systems managed through WMI.

WMIC is based on aliases. Aliases make the primary data provided by WMI available without having to understand WMI-specific concepts. WMI data and many WMI features are also accessible through WMI without aliases.

Return to Main Page

How to use

  • from CLI just type WMIC
    • you will get wmic:root\cli>
    • you can also type below to do a direct file write:
      • wmic COMMAND_STRING >>"FILE LOCATION\FILE NAME"
        • >> to append or > to overwrite
  • querying a PC:

/node:"PCNAME" /user:DOMAIN\USERNAME /password:"PASSWORD" ALIAS get VARIABLE,VARIABLE /format:list

    • for a local machine, do not include node.
    • replace above items in caps with the correct expressions.

Return to Top

Formats

Formats are the six different ways to return the requested query.

  • /format:table
    • the "default" style, with variables on one line and values below.
  • /format:list
    • one per line of variable: value
  • /format:csv
    • comma-separated values
    • needs output, see below.
  • /format:xml
    • XML page
    • needs output, see below.
  • /format:hform
    • HTML form (list)
    • needs output, see below.
  • /format:htable
    • HTML table
    • needs output, see below.

Return to Top

Output

/output:c:\DIR\FILE.EXT

  • put quotes around directory/file if containing spaces
    • "c:\output\file name.txt"
  • use corresponding extension for specific formats
    • XLM, HTM, TXT

Return to Top

Global switches

This is also obtainable via /?

  • /NAMESPACE Path for the namespace the alias operate against.
  • /ROLE Path for the role containing the alias definitions.
  • /NODE Servers the alias will operate against.
  • /IMPLEVEL Client impersonation level.
  • /AUTHLEVEL Client authentication level.
  • /LOCALE Language id the client should use.
  • /PRIVILEGES Enable or disable all privileges.
  • /TRACE Outputs debugging information to stderr.
  • /RECORD Logs all input commands and output.
  • /INTERACTIVE Sets or resets the interactive mode.
  • /FAILFAST Sets or resets the FailFast mode.
  • /USER User to be used during the session.
  • /PASSWORD Password to be used for session login.
  • /OUTPUT Specifies the mode for output redirection.
  • /APPEND Specifies the mode for output redirection.
  • /AGGREGATE Sets or resets aggregate mode.
  • /AUTHORITY Specifies the <authority type> for the connection.
  • /?[:<BRIEF|FULL>] Usage information.

Return to Top

References


Return to Top