Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบ >> Windows

คำสั่ง WMI (WMIC) ใน Windows 11/10

ทำงานกับ Command Prompt, Batch File สนุกดี ยังชอบทำงานอัตโนมัติด้วย Batch Files บทความนี้รวบรวม WMI Commands (Windows Management Instrumentation) สำหรับ Query ใน Windows 11/10/8/7 ต่างๆ

Windows Management Instrumentation Command line (WMIC)

คำสั่ง WMI (WMIC) ใน Windows 11/10

WMI คือ Infrastructure สำหรับ Management Data และ Operations บน Windows OS เขียน WMI Scripts/Applications เพื่อ Automate Administrative Tasks บน Remote Computers WMI ยังให้ Management Data กับส่วนอื่นของ OS และ Products เช่น System Center Operations Manager

Global Switches ที่ใช้ได้:

/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.

รายละเอียด Switch ใดๆ พิมพ์: switch-name /?

Aliases ที่ใช้ได้ใน Role ปัจจุบัน:

ALIAS - Access to the aliases available on the local system
BASEBOARD - Base board (motherboard/system board) management
BIOS - Basic input/output services (BIOS) management
BOOTCONFIG - Boot configuration management
CDROM - CD-ROM management
COMPUTERSYSTEM - Computer system management
CPU - CPU management
CSPRODUCT - Computer system product information from SMBIOS
DATAFILE - DataFile Management
DCOMAPP - DCOM Application management
DESKTOP - User's Desktop management
DESKTOPMONITOR - Desktop Monitor management
DEVICEMEMORYADDRESS - Device memory addresses management
DISKDRIVE - Physical disk drive management
DISKQUOTA - Disk space usage for NTFS volumes
DMACHANNEL - Direct memory access (DMA) channel management
ENVIRONMENT - System environment settings management
FSDIR - Filesystem directory entry management
GROUP - Group account management
IDECONTROLLER - IDE Controller management
IRQ - Interrupt request line (IRQ) management
JOB - Jobs scheduled using the schedule service
LOADORDER - System services execution dependencies
LOGICALDISK - Local storage device management
LOGON - LOGON Sessions
MEMCACHE - Cache memory management
MEMORYCHIP - Memory chip information
MEMPHYSICAL - Computer system's physical memory management
NETCLIENT - Network Client management
NETLOGIN - Network login information management
NETPROTOCOL - Protocols management
NETUSE - Active network connection management
NIC - Network Interface Controller management
NICCONFIG - Network adapter management
NTDOMAIN - NT Domain management
NTEVENT - Entries in the NT Event Log
NTEVENTLOG - NT eventlog file management
ONBOARDDEVICE - Onboard devices management
OS - Installed Operating System/s management
PAGEFILE - Virtual memory file swapping management
PAGEFILESET - Page file settings management
PARTITION - Partitioned areas management
PORT - I/O port management
PORTCONNECTOR - Physical connection ports management
PRINTER - Printer device management
PRINTERCONFIG - Printer device configuration management
PRINTJOB - Print job management
PROCESS - Process management
PRODUCT - Installation package task management
QFE - Quick Fix Engineering
QUOTASETTING - Disk quotas setting information
RDACCOUNT - Remote Desktop connection permission management
RDNIC - Remote Desktop connection management on specific adapter
RDPERMISSIONS - Permissions to specific Remote Desktop connection
RDTOGGLE - Turning Remote Desktop listener on/off remotely
RECOVEROS - Information gathered on OS failure
REGISTRY - Computer system registry management
SCSICONTROLLER - SCSI Controller management
SERVER - Server information management
SERVICE - Service application management
SHADOWCOPY - Shadow copy management
SHADOWSTORAGE - Shadow copy storage area management
SHARE - Shared resource management
SOFTWAREELEMENT - Software product elements management
SOFTWAREFEATURE - Software product subsets management
SOUNDDEV - Sound Device management
STARTUP - Commands running at user logon
SYSACCOUNT - System account management
SYSDRIVER - System driver for base service management
SYSTEMENCLOSURE - Physical system enclosure management
SYSTEMSLOT - Physical connection points management
TAPEDRIVE - Tape drive management
TEMPERATURE - Temperature sensor data management
TIMEZONE - Time zone data management
UPS - Uninterruptible power supply management
USERACCOUNT - User account management
VOLTAGE - Voltage sensor data management
VOLUME - Local storage volume management
VOLUMEQUOTASETTING - Disk quota setting per volume
VOLUMEUSERQUOTA - Per user storage volume quota management
WMISET - WMI service operational parameters management

รายละเอียด Alias ใดๆ พิมพ์: alias /?

CLASS - Escapes to full WMI schema. PATH - Escapes to full WMI object paths. CONTEXT - Displays global switches state. QUIT/EXIT - Exits program.

ตัวอย่าง: คำสั่ง QFE

QFE ใช้หา Hotfixes/Security Updates ที่ติดตั้งในระบบ

Usage:

เปิด Command Prompt พิมพ์ wmic qfe จะได้รายการ!

Output ตัวอย่าง:

Caption CSName Description HotFixID InstalledBy
https://go.microsoft.com/fwlink/?LinkId=161784 CAPTAINDBG Update KB971033 NT AUTHORITY\SYSTEM
https://support.microsoft.com/?kbid=2079403 CAPTAINDBG Security Update KB2079403 NT AUTHORITY\SYSTEM
https://support.microsoft.com/?kbid=2207566 CAPTAINDBG Security Update KB2207566 NT AUTHORITY\SYSTEM
https://support.microsoft.com/?kbid=2281679 CAPTAINDBG Security Update KB2281679 NT AUTHORITY\SYSTEM
https://support.microsoft.com/?kbid=2286198 CAPTAINDBG Security Update KB2286198 NT AUTHORITY\SYSTEM
https://support.microsoft.com/?kbid=2296011 CAPTAINDBG Security Update KB2296011 NT AUTHORITY\SYSTEM

อ่านต่อ: How to repair or rebuild the WMI Repository on Windows 11/10.

คำสั่ง WMI (WMIC) ใน Windows 11/10