Upload
sivextien
View
215
Download
0
Embed Size (px)
Citation preview
8/10/2019 Useful WMIC Queries
1/6
Useful WMIC QueriesBlake Morrison - MSFT
17 Feb 2012 4:00 AM
10
Hello AskPerf Blog Readers! This mornings post is going to be more of a reference point for all those WMI junkies out there. Have
you ever wanted to test WMI using the command line (outside of VBSCRIPT)? If so, then WMIC is the tool for you. In its simplest
form, WMIC is a utility that allows you to interact with WMI from a WMI-aware command-line shell. All WMI objects and their
properties, including their methods, are accessible through the shell, which makes WMIC an advanced systems management
console.
This blog will assume that you already have a grasp of WMI and are looking for more WMI testing options via the Command Line.
With that said, the following is a list of WMIC queries that you can run on your Workstations/Servers.
To execute these queries, run WMIC at a command prompt, followed by one of the following alias/es:
baseboardget Manufacturer, Model, Name, PartNumber,
slotlayout, serialnumber, poweredon
bios get name, version, serialnumber
bootconfigget BootDirectory, Caption, TempDirectory,Lastdrive
cdrom get Name, Drive, Volumename
computersystem
get Name, domain, Manufacturer, Model,
NumberofProcessors,PrimaryOwnerName,Username, Roles,
totalphysicalmemory /format:list
cpuget Name, Caption, MaxClockSpeed, DeviceID,status
datafile
where name='c:\\boot.ini' get Archive, FileSize,
FileType, InstallDate, Readable, Writeable,System, Version
dcomapp get Name, AppID /format:list
desktopget Name, ScreenSaverExecutable,ScreenSaverActive, Wallpaper /format:list
http://blogs.technet.com/186133/ProfileUrlRedirect.ashxhttp://blogs.technet.com/b/askperf/archive/2012/02/17/useful-wmic-queries.aspx#commentshttp://blogs.technet.com/b/askperf/archive/2012/02/17/useful-wmic-queries.aspx#commentshttp://blogs.technet.com/186133/ProfileUrlRedirect.ashx8/10/2019 Useful WMIC Queries
2/6
desktopmonitor get screenheight, screenwidth
diskdriveget Name, Manufacturer, Model, InterfaceType,MediaLoaded, MediaType
diskquota get User, Warninglimit, DiskSpaceUsed,QuotaVolume
environment get Description, VariableValue
fsdirwhere name='c:\\windows' get Archive,CreationDate, LastModified, Readable,
Writeable, System, Hidden, Status
groupget Caption, InstallDate, LocalAccount, Domain,
SID, Status
idecontroller get Name, Manufacturer, DeviceID, Status
irq get Name, Status
jobget Name, Owner, DaysOfMonth, DaysOfWeek,ElapsedTime, JobStatus, StartTime, Status
loadorder get Name, DriverEnabled, GroupOrder, Status
logicaldisk
get Name, Compressed, Description, DriveType,FileSystem, FreeSpace, SupportsDiskQuotas,
VolumeDirty, VolumeName
memcacheget Name, BlockSize, Purpose, MaxCacheSize,
Status
memlogical
get AvailableVirtualMemory,
TotalPageFileSpace, TotalPhysicalMemory,TotalVirtualMemory
memphysicalget Manufacturer, Model, SerialNumber,MaxCapacity, MemoryDevices
netclient get Caption, Name, Manufacturer, Status
netlogin
get Name, Fullname, ScriptPath, Profile, UserID,
NumberOfLogons, PasswordAge, LogonServer,HomeDirectory, PrimaryGroupID
netprotocol
get Caption, Description, GuaranteesSequencing,SupportsBroadcasting, SupportsEncryption,
Status
8/10/2019 Useful WMIC Queries
3/6
netuseget Caption, DisplayType, LocalName, Name,ProviderName, Status
nic
get AdapterType, AutoSense, Name, Installed,MACAddress,
PNPDeviceID,PowerManagementSupported,Speed, StatusInfo
nicconfigget MACAddress, DefaultIPGateway, IPAddress,
IPSubnet, DNSHostName, DNSDomain
nicconfigget MACAddress, IPAddress, DHCPEnabled,DHCPLeaseExpires, DHCPLeaseObtained,DHCPServer
nicconfig
get MACAddress, IPAddress, DNSHostName,
DNSDomain, DNSDomainSuffixSearchOrder,DNSEnabledForWINSResolution,DNSServerSearchOrder
nicconfig
get MACAddress, IPAddress,
WINSPrimaryServer, WINSSecondaryServer,
WINSEnableLMHostsLookup,WINSHostLookupFile
ntdomain
get Caption, ClientSiteName,
DomainControllerAddress,
DomainControllerName, Roles, Status
nteventwhere (LogFile='system' andSourceName='W32Time') get Message,
TimeGenerated
ntevent
where (LogFile='system' and
SourceName='W32Time' and Message like'%timesource%') get Message, TimeGenerated
ntevent
where (LogFile='system' and
SourceName='W32Time' and EventCode!='29')
get TimeGenerated, EventCode, Message
onboarddevice get Description, DeviceType, Enabled, Status
os
get Version, Caption, CountryCode, CSName,Description, InstallDate, SerialNumber,
ServicePackMajorVersion, WindowsDirectory
/format:list
8/10/2019 Useful WMIC Queries
4/6
os
get CurrentTimeZone, FreePhysicalMemory,FreeVirtualMemory, LastBootUpTime,
NumberofProcesses, NumberofUsers,
Organization, RegisteredUser, Status
pagefile get Caption, CurrentUsage, Status, TempPageFile
pagefileset get Name, InitialSize, MaximumSize
partition get Caption, Size, PrimaryPartition, Status, Type
printer
get DeviceID, DriverName, Hidden, Name,PortName, PowerManagementSupported,
PrintJobDataType, VerticalResolution,
Horizontalresolution
printjobget Description, Document, ElapsedTime,HostPrintQueue, JobID, JobStatus, Name, Notify,
Owner, TimeSubmitted, TotalPages
processget Caption, CommandLine, Handle,HandleCount, PageFaults, PageFileUsage,PArentProcessId, ProcessId, ThreadCount
productget Description, InstallDate, Name, Vendor,Version
qfeget description, FixComments, HotFixID,
InstalledBy, InstalledOn, ServicePackInEffect
quotasettingget Caption, DefaultLimit, Description,
DefaultWarningLimit, SettingID, State
recoverosget AutoReboot, DebugFilePath,WriteDebugInfo, WriteToSystemLog
Registryget CurrentSize, MaximumSize, ProposedSize,Status
scsicontrollerget Caption, DeviceID, Manufacturer,
PNPDeviceID
server
get ErrorsAccessPermissions,ErrorsGrantedAccess, ErrorsLogon,
ErrorsSystem, FilesOpen, FileDirectorySearches
serviceget Name, Caption, State, ServiceType,
StartMode, pathname
8/10/2019 Useful WMIC Queries
5/6
share get name, path, status
sounddevget Caption, DeviceID, PNPDeviceID,Manufacturer, status
startup get Caption, Location, Command
sysaccountget Caption, Domain, Name, SID, SIDType,Status
sysdriverget Caption, Name, PathName, ServiceType,State, Status
systemenclosure
get Caption, Height, Depth, Manufacturer, Model,
SMBIOSAssetTag, AudibleAlarm,
SecurityStatus, SecurityBreach, PoweredOn,
NumberOfPowerCords
systemslot
get Number, SlotDesignation, Status,SupportsHotPlug, Version, CurrentUsage,
ConnectorPinout
tapedriveget Name, Capabilities, Compression,Description, MediaType, NeedsCleaning, Status,
StatusInfo
timezoneget Caption, Bias, DaylightBias, DaylightName,
StandardName
useraccountget AccountType, Description, Domain, Disabled,LocalAccount, Lockout, PasswordChangeable,
PasswordExpires, PasswordRequired, SID
*UPDATE* 12/13/2012
memorychip
get BankLabel, Capacity, Caption,
CreationClassName, DataWidth, Description,Devicelocator, FormFactor, HotSwappable,
InstallDate, InterleaveDataDepth,
InterleavePosition, Manufacturer, MemoryType,Model, Name, OtherIdentifyingInfo, PartNumber,PositionInRow, PoweredOn, Removable,
Replaceable, SerialNumber, SKU, Speed, Status,
Tag, TotalWidth, TypeDetail, Version
8/10/2019 Useful WMIC Queries
6/6
In troubleshooting WMI issues here on the Performance team, I often run the following commands to test WMI locally and remotely:
WMIC CPU GET NAME
WMIC /NODE:SERVERNAME CPU GET NAME
Additional Resources
WMIC Take Command-line Control over WMI
Security with WMIC
WMIC verbs
-Blake Morrison
http://technet.microsoft.com/en-us/library/bb742610.aspxhttp://technet.microsoft.com/en-us/library/bb742610.aspxhttp://technet.microsoft.com/en-us/library/bb742610.aspxhttp://technet.microsoft.com/en-us/library/bb742610.aspxhttp://technet.microsoft.com/en-us/library/cc739091(WS.10).aspxhttp://technet.microsoft.com/en-us/library/cc739091(WS.10).aspxhttp://technet.microsoft.com/en-us/library/cc784966(WS.10).aspxhttp://technet.microsoft.com/en-us/library/cc784966(WS.10).aspxhttp://technet.microsoft.com/en-us/library/cc784966(WS.10).aspxhttp://technet.microsoft.com/en-us/library/cc739091(WS.10).aspxhttp://technet.microsoft.com/en-us/library/bb742610.aspx