Wmic instance application code sharing _dos/bat

Source: Internet
Author: User
Tags manual administrator password
As for the alias, it is to the motherboard, service, system, process of these and computer-related dongdong up an English name, in the Wmic.exe/? command line can also be seen
The syntax of the WQL statement is almost exactly the same as that of the SQL statements we normally use when injected, or even simpler. Generally is where name= "xxx" and the like, but sometimes to name= "xxx" Such a format to replace "name= ' xxx '" or WHERE (name= ' xxx ') so that, anyway, the normal situation is not possible to change the wording.
The verb, it's just so simple. Several assoc, call, CREATE, DELETE, GET, LIST, SET,

As to the adverb (the verb's parameter), we get the attribute of the object with the verb + its parameter. An adverb, like a list verb, shows what it is, such as a detailed state or a brief state.
The verb switch is like displaying a horizontal table or displaying a vertical form or output a file of what format, or a few seconds to repeat the message and so on, some verbs do not have a switch
wmic/output:c:\process.html Process Get processid,name,executablepath/format:htable
(WMIC) + (global switch) + (alias) + verb (adverb) + (verb switch)

BIOS Management
Column 1, displaying BIOS information
Enter in CMD: WMIC BIOS list full
Haha, are you dizzy? First in cmd input mode con cols=1200 lines=20 carriage return and then enter WMIC bioslist This new look much better.
List is a specific parameter and list determines the format and scope of the information displayed
Full is a parameter
Full= all show,-bioscharacteristics, (signature) BuildNumber, CodeSet, Currentlanguage, Description, ( Kind) Identificationcode, (identification code) installablelanguages, (Installation language) installdate (installation data), Languageedition, (language version) Listoflanguages, Manufacturer, (manufacturer) name, (name child) OtherTargetOS, (Other object system) Primarybios, (primary BIOS) ReleaseDate, (version date) SerialNumber, (String) SMBIOSBIOSVersion, Smbiosmajorversion, Smbiosminorversion, Smbiospresent, Softwareelementid, SoftwareElementState, Status, TargetOperatingSystem, Version
Instance= Object Instance-Name
status= Status-Status, Name, Caption, smbiospresent
system= Systems-__class, __derivation, __dynasty, __genus, __namespace, __path, __property_ COUNT, __relpath, __server, __superclass

column 2, displaying BIOS information
Enter in CMD: WMIC BIOS get

Column 3, display full BIOS information
Enter in CMD: WMIC BIOS get/value
Plus parameter value display more intuitive

Process Management
Column 1, displaying process summary information
Enter in CMD: WMIC process list Brief
Brief is a parameter, the list determines the format and scope of the information displayed, and the process is an alias

The following LIST formats are available:

Column 2, displaying process complete information
Enter in CMD: WMIC process get

The following LIST formats are available:
That is, you append the following parameters to the get, such as appending multiple parameters, separated by commas such as: WMIC process getting Csname,executablepath


Column 3, displaying a process information
Enter in CMD: WMIC process where (description= "Ttplayer.exe")

Column 4
The start path of the query process (output of the resulting information)
WMIC process Get Name,executablepath,processid
wmic/output:c:\process.html Process Get processid,name,executablepath/format:htable


Column 5, end a process (can be based on the process of the PID)
WMIC process where name= ' Outlook.exe ' call terminate
WMIC process where name= "notepad.exe" delete
WMIC process where name= "notepad.exe" terminate
WMIC process where pid= "123" Delete
WMIC path Win32_Process where "name= ' notepad.exe '" delete


List information for an installed program
WMIC product get Packagename= "*.msi"

To remove an installed program
WMIC product where name= "*" Delete
WMIC product where name= "Tencent qq2009" delete

The start path of the query process (output of the resulting information)
WMIC process get
wmic/output:c:\process.html Process Get processid,name,executablepath/format:htable.xsl


Querying for information about a specified process
WMIC process where name= "notepad.exe" Get Name,executablepath,processid
:: Name= process Name, executablepath= path, processid= process ID


Restart the remote computer
Wmic/node:192.168.8.10/user:administrator/password:xiongyefeng process Call Create "shutdown-r-F"

Turn off remote computers
Wmic/node:192.168.8.10/user:administrator/password:xiongyefeng process Call Create "shutdown-s-F"


Create a process
WMIC process Call create "D:\Program Files\ttplayer\ttplayer.exe"

To create a process on a remote calculation
Wmic/node:192.168.8.10/user:administrator/password:xiongyefeng process Call create "C:\Windows\Notepad.exe"


Disk Management

View remote Host C disk situation
Wmic/node: "192.168.8.100"/user: "Administrator"/password: "LCX"/output:a.html LogicalDisk where "Name= ' C: '" get Deviceid,size,freespace,description,filesystem/format:htable
Where node switch indicates to which machine to access, user and password of course is the remote machine username and password, this command has the above explanation, we should be at a glance.

Column 6, view the situation of this machine C disk
WMIC LogicalDisk where name= "C:" Get
:: caption= Description, compressed= compression, creationclassname= Create class name description= description, deviceid= drive ID number drivetype= drive type, filesystem= file system, freespace= remaining space, maximumcomponentlength size= Total capacity, status= status, systemname= computer name, volumename= volume label, VolumeSerialNumber Volume Label string

To view the properties of a disk
WMIC LogicalDisk list Brief
:: caption= title, driveid= Drive ID number, model= product model, partitions= partition, size= size

View the physical disk's true condition
WMIC diskdrive List
:: Caption Description, deviceid= drive ID number, model= original hard drive model number, partitions= partition total, size= hard drive size

Get the disk symbol of U disk
WMIC LogicalDisk where drivetype= ' 2 ' Get deviceid,description
WMIC LogicalDisk where "drivetype=2" Get Name
:: 2 = Mobile disk, 3= Local disk, 5= optical drive.

Change the name of a volume label
WMIC LogicalDisk where name= "C:" Set VOLUMENAME=LSXQ
:: Equivalent to label C:LSXQ

Installation Package Task management
Column 1 lists the installed procedures and other detailed information
WMIC product get
:: Can also add the following parameters separated by the bean number such as: WMIC prduct get Name,installdate,


System service Management


WMIC service where name= "TermService" Get ProcessID
:: Gets the PID number of the specified service process

WMIC service where state= ' running ' Get name,displayname
:: Displaying services that are running


WMIC service where state= ' running ' Get name,pathname
:: Displays the path of the executable file where the started service corresponds


WMIC service where name= "SharedAccess" StartService
:: Start a service


WMIC service where name= "SharedAccess" StopService
:: Stop a service

WMIC service where name= ' sharedaccess ' changestartmode ' automatic '
:: Set a service to self-boot (manual, disabled)

Show boot-initiated services
WMIC service where startmode= ' auto ' get name,displayname
::
Displays services that start from boot and are currently in a running state
WMIC service where "startmode= ' auto ' and state= ' running '" Get name,displayname
::
Show services that are disabled or started manually
WMIC service where ' startmode= ' disabled ' or startmode= ' manual ' Get Name,displayname
::


File Management

Change file name
WMIC datafile "c:\\temp\\1.txt" rename "C:\temp\2.txt"
:: Name the 1.txt file under C:\Temp as 2.txt

Copy a single file
WMIC datafile "c:\\test.txt" Copy "D:\lsxq.txt"

Gets a list of files for a specific extension under the specified path
WMIC datafile where "drive= ' C: ' and path= ' \ and extension= ' txt '" Get Name,path, "System File"

Delete Folder
WMIC Fsdir "C:\\test" delete

Folder Rename
WMIC Fsdir "c:\\test" rename "C:\lsxq"


Copy Folder
WMIC Fsdir WHERE (name= ' C:\\temp\\ken ') call copy "D:\ken1"
:: Copy the files in the Ken folder under C disk to the D disk ken1 inside, if the D disk Ken1 folder does not exist it will automatically create health, if there is a direct copy of the past.

Renaming folders
WMIC Fsdir WHERE (name= ' d:\\zhangzhimin ') rename "D:\ken"
:: Name the Zhangzhimin folder under D disk as Ken


Find the specified file in a comprehensive
WMIC datafile where "filename= ' QQ ' and extension= ' exe '" Get name

Obtain a specific extension under the specified path and require that only the file that satisfies the problem condition be displayed
WMIC datafile where "drive= ' e: ' and path= ' \\surecity\\ ' and extension= ' rar ' and filesize>1000 ' get name



Get file creation, access, modification time
Wmic datafile where name= "C:\\windows\\notepad.exe" Get creationdate,lastaccessed,lastmodified
:: createiondate= creation, lastaccessed= last access time, lastmodifie= last modified time


Compress the specified folder to save disk space
WMIC Fsdir WHERE (name= ' d:\\test ') call compress
:: Compress the Test folder on D disk and highlight in blue font

Unzip the specified folder
WMIC Fsdir WHERE (name= ' d:\\test ') call compress
:: Unzip the test folder on D disk and restore the normal font


Usage and examples of aliases

Alias Job
WMIC job call create "Sol.exe", 0,0,1,0,********154600.000000+480
::
Os Alias

WMIC OS Where (primary= ' 1 ') call Win32Shutdown *
This * parameter can have the following values:
Const logoff=0
Const Shutdown=1
Const reboot=2
Const force=4
Const poweroff=8

These parameters can be grouped in any combination, such as:

Force logoff: 4 (0+4) combination
Force shutdown: Combination of 5 (1+4)
Forced reboot: Combination of 6 (2+4)
Force power off: combination of 12 (8+4)


WMIC Set system time

Requires Administrator privileges
WMIC OS WHERE (primary=1) call SetDateTime 20120731144642.555555+480
:: Change Time July 31, 2010 14:46 42 seconds



Use to set priority for a program
WMIC process 2556 Call SetPriority 64

Idle Priority – Low
16384 Below Normal priority – below standard
Normal priority – Standard
32768 Above Normal priority – above standard
128 High Priority Priority-higher
256 Real Time Priority – live

Nicconfig Alias

WMIC Nicconfig WHERE (index= ' 8 ') call enablestatic "192.168.1.81″, 255.255.255.0"
:: Setting the IP address and subnet mask
:: index= ' 8 ' online indexed value, each online index value is different

WMIC Nicconfig WHERE (index= ' 8 ') call SetGateways "192.168.0.1″,1
:: Setting gateways and Metric

WMIC Nicconfig WHERE (index= ' 8 ') call SetDNSDomain ("192.168.0.1″, 192.168.0.11")
:: Set the DNS server address, after setting is not immediately effective, must be set primary and secondary to be effective

WMIC Nicconfig WHERE (index= ' 8 ') call SetDNSServerSearchOrder ("192.168.0.1", "192.168.0.11")
:: Sets the primary and secondary order of DNS server addresses, which are previously represented as preferred DNS addresses, followed by alternate DNS addresses (192.168.0.1)

WMIC path Win32_networkadapterconfiguration.index=8 Call EnableDHCP

WMIC default Nicconfig alias is not provided enabledhcp this method, so we can only call his WMI function to set the dynamic allocation of IP address settings

WMIC Nicconfig WHERE (index= ' 8 ') get/value the index value of your current network card is not the same for each machine. Please ask questions on Baidu

The following are the individual property values set for the network:

Arpalwayssourceroute=
arpuseethersnap=
CAPTION=[00000008] Broadcom 440x 10/100 Integrated Controller
Databasepath=%systemroot%\system32\drivers\etc
Deadgwdetectenabled=
defaultipgateway={"192.168.0.1″}"
defaulttos=
Defaultttl=
description=broadcom 440x 10/100 Integrated Controller-Packet Scheduler Mini port
Dhcpenabled=false
dhcpleaseexpires=
Dhcpleaseobtained=
Dhcpserver=
Dnsdomain= ("192.168.0.1″," 192.168.0.11″)
Dnsdomainsuffixsearchorder=
Dnsenabledforwinsresolution=false
Dnshostname=ql-libowen
dnsserversearchorder={"192.168.0.1″," 192.168.0.11″}
Domaindnsregistrationenabled=false
forwardbuffermemory=
Fulldnsregistrationenabled=true
Gatewaycostmetric={1}
Igmplevel=
Index=8
ipaddress={"192.168.0.81″}"
Ipconnectionmetric=20
Ipenabled=true
Ipfiltersecurityenabled=false
Ipportsecurityenabled=
ipsecpermitipprotocols={"0″}"
ipsecpermittcpports={"0″}"
ipsecpermitudpports={"0″}"
ipsubnet={"255.255.255.0″}"
ipusezerobroadcast=
ipxaddress=
Ipxenabled=false
Ipxframetype=
Ipxmediatype=
Ipxnetworknumber=
Ipxvirtualnetnumber=
Keepaliveinterval=
Keepalivetime=
Macaddress=00:0f:1f:4f:08:a0
mtu=
numforwardpackets=
Pmtubhdetectenabled=
Pmtudiscoveryenabled=
Servicename=bcm4sbxp
SETTINGID={B97AA60A-483E-4C84-84FE-5A3C6A875B65}
Tcpipnetbiosoptions=0
tcpmaxconnectretransmissions=
tcpmaxdataretransmissions=
tcpnumconnections=
Tcpuserfc1122urgentpointer=
Tcpwindowsize=
Winsenablelmhostslookup=true
winshostlookupfile=
Winsprimaryserver=
Winsscopeid=
Winssecondaryserver=


Pagefileset Alias

WMIC Pagefileset Get/value
:: View the local computer virtual memory situation, initial size, maximum value, save location

WMIC pagefileset Create name= ' D:\pagefile.sys ', initialsize=512,maximumsize=1024
:: Change the virtual memory file (that is, we often say that the page file) location for the D disk, the initial value of 521MB, the maximum is 1024MB
WMIC Pagefileset WHERE (name= ' c:\\pagefile.sys ') delete
:: And then delete the previous on it, you can implement the location of the virtual file

Share Alias

WMIC SHARE Call Create "", "Test", "3″," Testsharename "," "," C:\Test ", 0
:: Set C:\Test folder to share, share name: Testsharename, note: The number of temp connected users is up to 3 users

0-–disk Drive
1-–print Queue
2-–device
3-–ipc
2147483648--disk Drive Admin
2147483649--print Queue Admin
2147483650--device Admin
2147483651--IPC Admin


WMIC SHARE where (path= ' c:\\test ') delete
:: Deleting shared folders for C:\Test

ComputerSystem Alias

WMIC ComputerSystem Where "Name= ' Zhang" "Call rename" Ken "
:: Change the computer name Zhang to Ken needs to restart the computer

WMIC ComputerSystem Where "Name= ' Zhang" "Call JoinDomainOrWorkgroup" "," "," MyGroup "
:: Change the computer name "Zhang" to the MyGroup Working Group

WMIC ComputerSystem Where "name= ' computer name ' call Unjoindomainorworkgroup
:: Leave the computer name "Zhang" out of the domain

WMIC ComputerSystem Where "name= ' computer name" "Call JoinDomainOrWorkgroup" ", 1," Domain name "," Domain Admin password "," Domain Administrator username "
:: For example: The domain name you want to join is called Qlart, and the domain administrator username should be administrator@ql-art.com or qlart\administrator password: XXXXXX


UserAccount Alias

WMIC UserAccount WHERE (localaccount= ' 1 ' and name= ' good ') set Disabled=true
:: Disable the good user name setting to stop account usage

WMIC UserAccount WHERE (localaccount= ' 1 ' and name= ' good ') set fullname= "Hello world!"
:: Set the full name of the account with the user name good to how to are you must have this account on your computer, that's the premise.

Baseboard Alias

WMIC baseboard get Manufacturer,product,version
:: The model of the manufacturer, motherboard model, serial string and BIOS file of the motherboard can be obtained

CDROM alias

WMIC CDROM get Name,manufacturer,drive,description,deviceid
:: Get the model, manufacturer, letter, drive ID of the optical drive

CPU Alias
WMIC CPU Get >d:\cpu.txt
:: In D disk open named CPU text file can see a CPU details, remember will Notepad "automatic line" tick remove, otherwise let you see dazzling, also see what the Ming Tang

Csproduct Alias

WMIC CSPRODUCT list Brief
:: Displaying BIOS information

Desktopmonitor Alias

WMIC Desktopmonitor Get >d:\monitor.txt
:: Open in D disk named CPU text file can see a CPU details, remember to Notepad "automatic line" hook removed

Environment Alias

WMIC Environment List >d:\m.txt&&start D:\m.txt
:: Viewing environment variables

Group Alias

WMIC Group List >d:\group.txt
:: In D disk, open the name group text file to see the details of a group account, remember the Notepad "Automatic line wrap" Check out

WMIC + alias +list >d:\group.txt
:: You will get the appropriate information, such as: In the cmd input WMIC idecontroller list >d:\group.txt carriage return

Alias

Idecontroller-ide Controller Management.
IRQ-Interval request line (IRQ) management.
Job-provides access to work scheduled for using the scheduling service.
Loadorder-defines system service management that performs dependencies.
LogicalDisk-local storage equipment management.
Logon-logon session.
MEMCACHE-cache memory management.
Memlogical-System memory management (configuration layout and memory availability).
Memphysical-Computer system physical memory management.
Netclient-Network client management.
Netlogin-(a user's) network login information management.
Netprotocol-Protocol (and its network characteristics) management.
Netuse-Active network connection management.
Nic-Network Interface Controller (NIC) management.
Nicconfig-Network adapter management.
NTDOMAIN-NT domain management.
Items for Ntevent-nt Event log
Nteventlog-nt time log file management.
Onboarddevice-Master Board (System board) built-in general adapter device management.
OS-installed operating system management.
PAGEFILE-Virtual memory file swap management.
Pagefileset-Paging File Settings management.
PARTITION-Management of the physical disk partition area.
PORT-I/O Port management.
Portconnector-Physical connection port management.
PRINTER-Printer Device management.
Printerconfig-Printer device configuration management.
PRINTJOB-Print job management.
Process-processes management.
PRODUCT-Installation Package task management.
QFE-Fast Troubleshooting.
Quotasetting-Sets disk quota information for the volume.
Recoveros-information that will be collected from memory when the operating system fails.
REGISTRY-Computer system registry management.
SCSICONTROLLER-SCSI Controller Management.
Server-Information management for servers.
Service-Services Program management.
SHARE-shared resource management.
Softwareelement-management of software PRODUCT elements that are installed on the system.
Softwarefeature-softwareelement the management of software product components.
Sounddev-sound device management.
STARTUP-Automatically runs command management when a user logs on to the computer system.
Sysaccount-System account management.
Sysdriver-System driver management for basic services.
Systemenclosure-Physical system closure management.
Systemslot-Physical connection point management including ports, sockets, attachments, and primary connection points
TapeDrive-Tape drive management.
Temperature-temperature sensor data management (electronic temperature meter).
TIMEZONE-time Area data management.
UPS-Non-disruptive power supply (UPS) management.
UserAccount-User account management.
Voltage-voltage sensor (electronic meter) data management.
Volumequotasetting-Associates a disk volume with disk quota settings.

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.