1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
使用wmic识别安装到系统中的补丁情况C:\> wmic qfe get description,installedOn识别开机启动的程序,包括路径C:\>wmic startup list full查看系统中网卡的IP地址和MAC地址D:\>wmic nicconfig get ipaddress,macaddress用户列表D:\>wmic useraccount list brief查看当前系统是否有屏保保护,延迟是多少D:\>wmic desktop get screensaversecure,screensavertimeout域控机器D:\>wmic ntdomain list brief登录用户D:\>wmic logon list brief查看系统中开放的共享D:\>wmic share get name,pathD:\>net share卸载和重新安装程序wmic product where "name like '%Office%'" get namewmic product where name="Office" call uninstall查看系统中开启的日志C:\>wmic nteventlog get path,filename,writeable查看系统中安装的软件以及版本C:\>wmic product get name,version服务列表wmic service list brief |more查看某个进程的详细信息 (路径,命令行参数等)C:\>wmic process where name="chrome.exe" list full终止一个进程D:\>wmic process where name="xshell.exe" call terminateD:\>ntsd -c q -p 进程的PIDD:\>taskkill -im pid查看当前系统是否是VMWAREC:\>wmic bios list full | find /i "vmware"杀毒软件Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProductwmic process where "name like '%forti%'" get namewmic process where name="FortiTray.exe" call terminate虚拟机检测1. 判断TotalPhysicalMemory和NumberOfLogicalProcessors$VMDetected = $False$Arguments = @{Class = 'Win32_ComputerSystem'Filter = 'NumberOfLogicalProcessors < 2 AND TotalPhysicalMemory <2147483648'}if (Get-WmiObject @Arguments) {$VMDetected = $True"In vm"}else{"Not in vm"}2. 判断虚拟机进程$VMwareDetected = $False$VMAdapter = Get-WmiObject Win32_NetworkAdapter -Filter 'Manufacturer LIKE"%VMware%" OR Name LIKE "%VMware%"'$VMBios = Get-WmiObject Win32_BIOS -Filter 'SerialNumber LIKE "%VMware%"'$VMToolsRunning = Get-WmiObject Win32_Process -Filter'Name="vmtoolsd.exe"'if ($VMAdapter -or $VMBios -or $VMToolsRunning){ $VMwareDetected = $True"in vm"}else{"not in vm"}获取电脑产品编号和型号信息wmic baseboard get Product,SerialNumberwmic bios get serialnumber安装软件wmic product get name,versionwmic product list brief通过Powershell调取wmi操作系统相关信息Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_OperatingSystemGet-WmiObject -Namespace ROOT\CIMV2 -Class Win32_ComputerSystemGet-WmiObject -Namespace ROOT\CIMV2 -Class Win32_BIOS文件/目录列表Get-WmiObject -Namespace ROOT\CIMV2 -Class CIM_DataFile磁盘卷列表Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Volume注册表操作Get-WmiObject -Namespace ROOT\DEFAULT -Class StdRegProvPush-Location HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\RunGet-ItemProperty OptionalComponents当前进程Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Process列举服务Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Service日志Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_NtLogEvent登陆账户Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_LoggedOnUser共享Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_Share补丁Get-WmiObject -Namespace ROOT\CIMV2 -Class Win32_QuickFixEngineering杀毒软件Get-WmiObject -Namespace root\SecurityCenter2 -Class AntiVirusProduct