Powerful command-line tool WMIC

Source: Internet
Author: User
Tags xsl

1.wmic=microsoft Windows Management Instrumentation

2. C:\WINDOWS\system32\wbem things under, especially. xsl format file to implement WMIC formatted output
such as wmic/output:c:\process.html process list/format:htable.xsl

/format:textvaluelist.xsl

/format:hform.xsl

/format:htable.xsl

/format:csv.xsl

/format:xml.xsl

What can 3.wmic do? System Management, remote host information acquisition ... All can

4.wmic/?

See what properties are available for WMIC objects: WMIC object name get/? For example
WMIC process get/?

View the value of a property of a WMIC object: WMIC object name Get object a property such as
WMIC process GET Name

Process-progress Management

:: Lists the core information of the process, similar to Task Manager
WMIC Process List Brief

:: New Notepad process
WMIC process Call Create Notepad

:: List information for a process
WMIC process Get Caption,handle,commandline,executablepath

:: End Process
WMIC process [Handle/pid] Delete
WMIC process [Handle/pid] call terminate

:: End Svchost.exe process, path is non-C:\WINDOWS\system32\svchost.exe
WMIC process where "name= ' Svchost.exe ' and executablepath<> ' C:\\windows\\system32\\svchost.exe '" Call Terminate

:: End Svchost.exe process, path is C:\WINDOWS\svchost.exe (key: \ must be changed to \ \ in path)
WMIC process where "name= ' Svchost.exe ' and executablepath= ' C:\\windows\\svchost.exe '" Call Terminate


BIOS-Basic input/Output service (BIOS) management

:: View BIOS version model
WMIC BIOS Get Name,smbiosbiosversion,manufacturer

ComputerSystem-Computer System Management

:: View hardware, operating system basic information
WMIC ComputerSystem Get Name,workgroup,numberofprocessors,manufacturer,model

:: View system Boot options contents of boot. ini
WMIC ComputerSystem Get SystemStartupOptions

:: View workgroup/Domain
WMIC ComputerSystem Get Domain

:: Change the computer name ABC to 123
WMIC ComputerSystem where "name= ' abc '" Call Rename 123

:: Change workgroup google to MyGroup
WMIC ComputerSystem where "name= ' Google '" Call JoinDomainOrWorkgroup "", "", "MyGroup", 1

CPU-CPU Management

:: View CPU Model
WMIC CPU Get Name

Datafile-datafile Management

:: Find the Cc.cmd file under the test directory (excluding subdirectories) under the E drive
WMIC datafile where "drive= ' e: ' and path= ' \\test\\ ' and filename= ' cc ' and extension= ' cmd '" list

:: Find the Cc.cmd file under all directories and subdirectories under the E drive, and the file size is greater than 1K
WMIC datafile where "drive= ' e: ' and Filename= ' cc ' and extension= ' cmd ' and filesize> '" list

:: Delete. cmd file with file size greater than 10M under E disk
WMIC datafile where "drive= ' e: ' and extension= ' cmd ' and filesize> ' 10000000 '" Call Delete

:: Delete the non. cmd file under the test directory (excluding subdirectories) under E disk
WMIC datafile where "drive= ' e: ' and extension<> ' cmd ' and path= ' test '" call Delete

:: Copy the Cc.cmd file under the test directory (excluding subdirectories) under E disk to E:\ and renamed Aa.bat
WMIC datafile where "drive= ' e: ' and path= ' \\test\\ ' and filename= ' cc ' and extension= ' cmd '" Call copy "E:\aa.bat"

:: Renamed C:\hello.txt to C:\test.txt
WMIC datafile "C:\\hello.txt" Call rename C:\test.txt

:: Find the H Drive directory containing test, file name with Perl, txt suffix
WMIC datafile where "drive= ' H: ' and extension= ' txt ' and path like '%\\test\\% ' and filename like '%perl% '" Get name

Desktopmonitor-Monitor Management

:: Get screen resolution
WMIC desktopmonitor where status= ' OK ' get screenheight,screenwidth

DiskDrive-Physical Disk drive management

:: Get Physical Disk model size, etc.
WMIC diskdrive Get Caption,size,interfacetype

Environment-System Environment settings management

:: Get TEMP environment variable
WMIC environment where "name= ' temp '" Get username,variablevalue

:: Change the value of the PATH environment variable, add E:\tools
WMIC environment where "name= ' path ' and username= ' <system> '" Set variablevalue= "%path%;e:\tools"

:: Add system environment variable home, value is%homedrive%%homepath%
WMIC environment Create Name= "Home", Username= "<system>", variablevalue= "%homedrive%%homepath%"

:: Delete Home environment variable
WMIC environment where "name= ' home '" delete

Fsdir-File Directory System project management

:: Find a directory named Test on the E drive
WMIC fsdir where "drive= ' e: ' and filename= ' test '" list

:: Delete all directories except directory ABC under the E:\test directory
WMIC fsdir where "drive= ' e: ' and path= ' \\test\\ ' and filename<> ' abc '" Call Delete

:: Delete C:\good folder
WMIC Fsdir "C:\\good" Call Delete

:: Rename C:\good folder for ABB
WMIC Fsdir "C:\\good" rename "C:\abb"

LogicalDisk-Local storage device management

:: Get Hard Drive system format, total size, free space, etc.
WMIC LogicalDisk Get Name,description,filesystem,size,freespace

Nic-Network Interface Controller (NIC) management

OS-Installed operating system management

:: Setting the system time
WMIC OS WHERE (primary=1) call SetDateTime 20070731144642.555555+480

Pagefileset-page File Setup Management

:: Change the current page file initial size and maximum value
WMIC Pagefileset set initialsize= "512", maximumsize= "

:: Page file set to D:\, execute the following two commands
WMIC pagefileset Create name= ' D:\pagefile.sys ', initialsize=512,maximumsize=1024
WMIC pagefileset where "name= ' C:\\pagefile.sys '" delete


PRODUCT-Installation Package task management

:: Install package in C:\WINDOWS\Installer directory

:: Uninstall the. msi installation package
WMIC PRODUCT where "Name= ' Microsoft. NET Framework 1.1 ' and version= ' 1.1.4322 '" Call Uninstall

:: Fix. msi installation package
WMIC PRODUCT where "Name= ' Microsoft. NET Framework 1.1 ' and version= ' 1.1.4322 '" Call Reinstall

Service-Services Program management

:: Run Spooler service
WMIC SERVICE where name= "Spooler" Call StartService

:: Stop Spooler service
WMIC SERVICE where name= "Spooler" Call StopService

:: Pause Spooler Service
WMIC SERVICE where name= "Spooler" Call Pauseservice

:: Change Spooler service startup Type [auto| disabled| Manual [Automatic | disable | manual]
WMIC SERVICE where name= "Spooler" set startmode= "Auto"

:: Delete Service
WMIC SERVICE where name= "test123" Call Delete

SHARE-Shared resource management

:: Delete Share
WMIC SHARE where name= "e$" Call Delete

:: Add Share
WMIC SHARE Call Create "", "Test", "3", "Testsharename", "", "C:\Test", 0

Sounddev-Sound device Management
WMIC Sounddev List

STARTUP-the management of the autorun command when a user logs on to a computer system

:: View startup options in Msconfig
WMIC STARTUP List

Sysdriver-System driver management for basic services
WMIC Sysdriver List

UserAccount-User account Management

:: Change user Administrator full name to admin
WMIC UserAccount where name= "Administrator" set fullname= "admin"

:: Change user name admin to admin00
WMIC useraccount where "name= ' admin" call Rename admin00

Powerful command-line tool WMIC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.