本地服务器硬件信息获取指令wmic

获取BIOS序列号

wmic bios list full | find "SerialNumber"

SerialNumber=P50168VB

 

获取CPUID(WIN32_PROCESSOR)

wmic cpu list full | find "ProcessorId"

rem 提取CPU名称和描述的批处理语句

@echo off
for /f "delims=" %%a in ('wmic cpu get name^,description /value^|findstr "="') do set "%%a"
echo;%name%
echo;%description%

ProcessorId=BFEBFBFF000306B9

 

获取DMI的UUID(WIN32_COMPUTERSYSTEMPRODUCT)

wmic  CSPRODUCT list full | find "UUID"

UUID=8FF4BB08-1B74-11E5-8500-441C3E291000

 

获取网卡的MAC地址(WIN32_NETWORKADAPTER)

wmic nic list full | findstr "MACAddress"

wmic nic where ( MACAddress is not null) get adaptertype , MACAddress

wmic nic where (MACAddress is not null and  PNPDeviceID like '%PCI%' ) get adaptertype , MACAddress

 

系统信息获取例子

wmic os       list brief /format:hform >PCinfo.html
wmic bios     list brief /format:hform >>PCinfo.html
wmic baseboard list brief /format:hform >>PCinfo.html
wmic csproduct list full /format:hform >>PCinfo.html
wmic cpu      list full /format:hform >>PCinfo.html
wmic nic       list full /format:hform >>PCinfo.html
wmic computersystem list brief /format:hform >>PCinfo.html
wmic diskdrive list full /format:hform >>PCinfo.html
wmic memphysical list full /format:hform >>PCinfo.html

 

pause
rem wmic process call create "shutdown.exe -s"

WMIC命令


ALIAS - 访问本地机器上的别名
BASEBOARD - 基板 (也叫母板或系统板) 管理。
BIOS - 基本输入/输出服务 (BIOS) 管理。
BOOTCONFIG - 启动配置管理。
CDROM - CD-ROM 管理。
COMPUTERSYSTEM - 计算机系统管理。
CPU - CPU 管理。
CSPRODUCT - SMBIOS 的计算机系统产品信息。
DATAFILE - DataFile 管理。
DCOMAPP - DCOM 程序管理。
DESKTOP - 用户桌面管理。
DESKTOPMONITOR - 监视器管理。
DEVICEMEMORYADDRESS - 设备内存地址管理。
DISKDRIVE - 物理磁盘驱动器管理。
DISKQUOTA - NTFS 卷磁盘空间使用情况。
DMACHANNEL - 直接内存访问(DMA)频道管理。
ENVIRONMENT - 系统环境设置管理。
FSDIR - 文件目录系统项目管理。
GROUP - 组帐户管理。
IDECONTROLLER - IDE 控制器管理。
IRQ - 间隔请求线 (IRQ) 管理。
JOB - 提供对使用计划服务安排的工作的访问。
LOADORDER - 定义执行依存的系统服务管理。
LOGICALDISK - 本地储存设备管理。
LOGON - 登录会话。
MEMCACHE - 缓存内存管理。
MEMLOGICAL - 系统内存管理 (配置布局和内存可用性)。
MEMPHYSICAL - 计算机系统物理内存管理。
NETCLIENT - 网络客户端管理。
NETLOGIN - (某一用户的)网络登录信息管理。
NETPROTOCOL - 协议 (和其网络特点) 管理。
NETUSE - 活动网络连接管理。
NIC - 网络界面控制器 (NIC) 管理。
NICCONFIG - 网络适配器管理。
NTDOMAIN - NT 域管理。
NTEVENT - NT 事件日志的项目
NTEVENTLOG - NT 时间日志文件管理。
ONBOARDDEVICE - 母板(系统板)内置普通设适配器设备的管理。
OS - 已安装的操作系统管理。
PAGEFILE - 虚拟内存文件对调管理。
PAGEFILESET - 页面文件设置管理。
PARTITION - 物理磁盘分区区域的管理。
PORT - I/O 端口管理。
PORTCONNECTOR - 物理连接端口管理。
PRINTER - 打印机设备管理。
PRINTERCONFIG - 打印机设备配置管理。
PRINTJOB - 打印工作管理。
PROCESS - 进程管理。
PRODUCT - 安装包任务管理。
QFE - 快速故障排除。
QUOTASETTING - 设置卷的磁盘配额信息。
RECOVEROS - 当操作系统失败时,将从内存收集的信息。
REGISTRY - 计算机系统注册表管理。
SCSICONTROLLER - SCSI 控制器管理。
SERVER - 服务器信息管理。
SERVICE - 服务程序管理。
SHARE - 共享资源管理。
SOFTWAREELEMENT - 安装在系统上的软件产品元素的管理。
SOFTWAREFEATURE - SoftwareElement 的软件产品组件的管理。
SOUNDDEV - 声音设备管理。
STARTUP - 用户登录到计算机系统时自动运行命令的管理。
SYSACCOUNT - 系统帐户管理。
SYSDRIVER - 基本服务的系统驱动程序管理。
SYSTEMENCLOSURE - 物理系统封闭管理。
SYSTEMSLOT - 包括端口、插口、附件和主要连接点的物理连接点管理。
TAPEDRIVE - 磁带驱动器管理。
TEMPERATURE - 温度感应器的数据管理 (电子温度表)。
TIMEZONE - 时间区域数据管理。
UPS - 不可中断的电源供应 (UPS) 管理。
USERACCOUNT - 用户帐户管理。
VOLTAGE - 电压感应器 (电子电量计) 数据管理。
VOLUMEQUOTASETTING - 将某一磁盘卷与磁盘配额设置关联。
WMISET - WMI 服务操作参数管理。

 

 

所有Win32 Classes (Win32节点) 

Wmic Path Win32_1394Controller 
Wmic Path Win32_1394ControllerDevice 
Wmic Path Win32_Account 
Wmic Path Win32_AccountSID 
Wmic Path Win32_ACE 
Wmic Path Win32_ActionCheck 
Wmic Path Win32_ActiveRoute 
Wmic Path Win32_AllocatedResource 
Wmic Path Win32_ApplicationCommandLine 
Wmic Path Win32_ApplicationService 
Wmic Path Win32_AssociatedBattery 
Wmic Path Win32_AssociatedProcessorMemory 
Wmic Path Win32_AutochkSetting 
Wmic Path Win32_BaseBoard 
Wmic Path Win32_BaseService 
Wmic Path Win32_Battery 
Wmic Path Win32_Binary 
Wmic Path Win32_BindImageAction 
Wmic Path Win32_BIOS 
Wmic Path Win32_BootConfiguration 
Wmic Path Win32_Bus 
Wmic Path Win32_CacheMemory 
Wmic Path Win32_CDROMDrive 
Wmic Path Win32_CheckCheck 
Wmic Path Win32_CIMLogicalDeviceCIMDataFile 
Wmic Path Win32_ClassicCOMApplicationClasses 
Wmic Path Win32_ClassicCOMClass 
Wmic Path Win32_ClassicCOMClassSetting 
Wmic Path Win32_ClassicCOMClassSettings 
Wmic Path Win32_ClassInfoAction 
Wmic Path Win32_ClientApplicationSetting 
Wmic Path Win32_CodecFile 
Wmic Path Win32_CollectionStatistics 
Wmic Path Win32_COMApplication 
Wmic Path Win32_COMApplicationClasses 
Wmic Path Win32_COMApplicationSettings 
Wmic Path Win32_COMClass 
Wmic Path Win32_ComClassAutoEmulator 
Wmic Path Win32_ComClassEmulator 
Wmic Path Win32_CommandLineAccess 
Wmic Path Win32_ComponentCategory 
Wmic Path Win32_ComputerShutdownEvent 
Wmic Path Win32_ComputerSystem 
Wmic Path Win32_ComputerSystemEvent 
Wmic Path Win32_ComputerSystemProcessor 
Wmic Path Win32_ComputerSystemProduct 
Wmic Path Win32_ComputerSystemWindowsProductActivationSetting 
Wmic Path Win32_COMSetting 
Wmic Path Win32_Condition 
Wmic Path Win32_ConnectionShare 
Wmic Path Win32_ControllerHasHub 
Wmic Path Win32_CreateFolderAction 
Wmic Path Win32_CurrentProbe 
Wmic Path Win32_CurrentTime 
Wmic Path Win32_DCOMApplication 
Wmic Path Win32_DCOMApplicationAccessAllowedSetting 
Wmic Path Win32_DCOMApplicationLaunchAllowedSetting 
Wmic Path Win32_DCOMApplicationSetting 
Wmic Path Win32_DefragAnalysis 
Wmic Path Win32_DependentService 
Wmic Path Win32_Desktop 
Wmic Path Win32_DesktopMonitor 
Wmic Path Win32_DeviceBus 
Wmic Path Win32_DeviceChangeEvent 
Wmic Path Win32_DeviceMemoryAddress 
Wmic Path Win32_DeviceSettings 
Wmic Path Win32_DFSNode 
Wmic Path Win32_DFSNodeTarget 
Wmic Path Win32_DFSTarget 
Wmic Path Win32_Directory 
Wmic Path Win32_DirectorySpecification 
Wmic Path Win32_DiskDrive 
Wmic Path Win32_DiskDrivePhysicalMedia 
Wmic Path Win32_DiskDriveToDiskPartition 
Wmic Path Win32_DiskPartition 
Wmic Path Win32_DiskQuota 
Wmic Path Win32_DisplayConfiguration 
Wmic Path Win32_DisplayControllerConfiguration 
Wmic Path Win32_DMAChannel 
Wmic Path Win32_DriverForDevice 
Wmic Path Win32_DriverVXD 
Wmic Path Win32_DuplicateFileAction 
Wmic Path Win32_Environment 
Wmic Path Win32_EnvironmentSpecification 
Wmic Path Win32_ExtensionInfoAction 
Wmic Path Win32_Fan 
Wmic Path Win32_FileSpecification 
Wmic Path Win32_FloppyController 
Wmic Path Win32_FloppyDrive 
Wmic Path Win32_FontInfoAction 
Wmic Path Win32_Group 
Wmic Path Win32_GroupInDomain 
Wmic Path Win32_GroupUser 
Wmic Path Win32_HeatPipe 
Wmic Path Win32_IDEController 
Wmic Path Win32_IDEControllerDevice 
Wmic Path Win32_ImplementedCategory 
Wmic Path Win32_InfraredDevice 
Wmic Path Win32_IniFileSpecification 
Wmic Path Win32_InstalledSoftwareElement 
Wmic Path Win32_IP4PersistedRouteTable 
Wmic Path Win32_IP4RouteTable 
Wmic Path Win32_IP4RouteTableEvent 
Wmic Path Win32_IRQResource 
Wmic Path Win32_JobObjectStatus 
Wmic Path Win32_Keyboard 
Wmic Path Win32_LaunchCondition 
Wmic Path Win32_LoadOrderGroup 
Wmic Path Win32_LoadOrderGroupServiceDependencies 
Wmic Path Win32_LoadOrderGroupServiceMembers 
Wmic Path Win32_LocalTime 
Wmic Path Win32_LoggedOnUser 
Wmic Path Win32_LogicalDisk 
Wmic Path Win32_LogicalDiskRootDirectory 
Wmic Path Win32_LogicalDiskToPartition 
Wmic Path Win32_LogicalFileAccess 
Wmic Path Win32_LogicalFileAuditing 
Wmic Path Win32_LogicalFileGroup 
Wmic Path Win32_LogicalFileOwner 
Wmic Path Win32_LogicalFileSecuritySetting 
Wmic Path Win32_LogicalMemoryConfiguration 
Wmic Path Win32_LogicalProgramGroup 
Wmic Path Win32_LogicalProgramGroupDirectory 
Wmic Path Win32_LogicalProgramGroupItem 
Wmic Path Win32_LogicalProgramGroupItemDataFile 
Wmic Path Win32_LogicalShareAccess 
Wmic Path Win32_LogicalShareAuditing 
Wmic Path Win32_LogicalShareSecuritySetting 
Wmic Path Win32_LogonSession 
Wmic Path Win32_LogonSessionMappedDisk 
Wmic Path Win32_LUID 
Wmic Path Win32_LUIDandAttributes 
Wmic Path Win32_ManagedSystemElementResource 
Wmic Path Win32_MappedLogicalDisk 
Wmic Path Win32_MemoryArray 
Wmic Path Win32_MemoryArrayLocation 
Wmic Path Win32_MemoryDevice 
Wmic Path Win32_MemoryDeviceArray 
Wmic Path Win32_MemoryDeviceLocation 
Wmic Path Win32_MethodParameterClass 
Wmic Path Win32_MIMEInfoAction 
Wmic Path Win32_ModuleLoadTrace 
Wmic Path Win32_ModuleTrace 
Wmic Path Win32_MotherboardDevice 
Wmic Path Win32_MountPoint 
Wmic Path Win32_MoveFileAction 
Wmic Path Win32_MSIResource 
Wmic Path Win32_NamedJobObject 
Wmic Path Win32_NamedJobObjectActgInfo 
Wmic Path Win32_NamedJobObjectLimit 
Wmic Path Win32_NamedJobObjectLimitSetting 
Wmic Path Win32_NamedJobObjectProcess 
Wmic Path Win32_NamedJobObjectSecLimit 
Wmic Path Win32_NamedJobObjectSecLimitSetting 
Wmic Path Win32_NamedJobObjectStatistics 
Wmic Path Win32_NetworkAdapter 
Wmic Path Win32_NetworkAdapterConfiguration 
Wmic Path Win32_NetworkAdapterSetting 
Wmic Path Win32_NetworkClient 
Wmic Path Win32_NetworkConnection 
Wmic Path Win32_NetworkLoginProfile 
Wmic Path Win32_NetworkProtocol 
Wmic Path Win32_NTDomain 
Wmic Path Win32_NTEventlogFile 
Wmic Path Win32_NTLogEvent 
Wmic Path Win32_NTLogEventComputer 
Wmic Path Win32_NTLogEventLog 
Wmic Path Win32_NTLogEventUser 
Wmic Path Win32_ODBCAttribute 
Wmic Path Win32_ODBCDataSourceAttribute 
Wmic Path Win32_ODBCDataSourceSpecification 
Wmic Path Win32_ODBCDriverAttribute 
Wmic Path Win32_ODBCDriverSoftwareElement 
Wmic Path Win32_ODBCDriverSpecification 
Wmic Path Win32_ODBCSourceAttribute 
Wmic Path Win32_ODBCTranslatorSpecification 
Wmic Path Win32_OnBoardDevice 
Wmic Path Win32_OperatingSystem 
Wmic Path Win32_OperatingSystemAutochkSetting 
Wmic Path Win32_OperatingSystemQFE 
Wmic Path Win32_OSRecoveryConfiguration 
Wmic Path Win32_PageFile 
Wmic Path Win32_PageFileElementSetting 
Wmic Path Win32_PageFileSetting 
Wmic Path Win32_PageFileUsage 
Wmic Path Win32_ParallelPort 
Wmic Path Win32_Patch 
Wmic Path Win32_PatchFile 
Wmic Path Win32_PatchPackage 
Wmic Path Win32_PCMCIAController 
Wmic Path Win32_Perf 
Wmic Path Win32_PerfFormattedData 
Wmic Path Win32_PerfFormattedData_ASP_ActiveServerPages 
Wmic Path Win32_PerfFormattedData_ContentFilter_IndexingServiceFilter 
Wmic Path Win32_PerfFormattedData_ContentIndex_IndexingService 
Wmic Path Win32_PerfFormattedData_InetInfo_InternetInformationServicesGlobal 
Wmic Path Win32_PerfFormattedData_ISAPISearch_HttpIndexingService 
Wmic Path Win32_PerfFormattedData_MSDTC_DistributedTransactionCoordinator 
Wmic Path Win32_PerfFormattedData_NTFSDRV_SMTPNTFSStoreDriver 
Wmic Path Win32_PerfFormattedData_PerfDisk_LogicalDisk 
Wmic Path Win32_PerfFormattedData_PerfDisk_PhysicalDisk 
Wmic Path Win32_PerfFormattedData_PerfNet_Browser 
Wmic Path Win32_PerfFormattedData_PerfNet_Redirector 
Wmic Path Win32_PerfFormattedData_PerfNet_Server 
Wmic Path Win32_PerfFormattedData_PerfNet_ServerWorkQueues 
Wmic Path Win32_PerfFormattedData_PerfOS_Cache 
Wmic Path Win32_PerfFormattedData_PerfOS_Memory 
Wmic Path Win32_PerfFormattedData_PerfOS_Objects 
Wmic Path Win32_PerfFormattedData_PerfOS_PagingFile 
Wmic Path Win32_PerfFormattedData_PerfOS_Processor 
Wmic Path Win32_PerfFormattedData_PerfOS_System 
Wmic Path Win32_PerfFormattedData_PerfProc_FullImage_Costly 
Wmic Path Win32_PerfFormattedData_PerfProc_Image_Costly 
Wmic Path Win32_PerfFormattedData_PerfProc_JobObject 
Wmic Path Win32_PerfFormattedData_PerfProc_JobObjectDetails 
Wmic Path Win32_PerfFormattedData_PerfProc_Process 
Wmic Path Win32_PerfFormattedData_PerfProc_ProcessAddressSpace_Costly 
Wmic Path Win32_PerfFormattedData_PerfProc_Thread 
Wmic Path Win32_PerfFormattedData_PerfProc_ThreadDetails_Costly 
Wmic Path Win32_PerfFormattedData_PSched_PSchedFlow 
Wmic Path Win32_PerfFormattedData_PSched_PSchedPipe 
Wmic Path Win32_PerfFormattedData_RemoteAccess_RASPort 
Wmic Path Win32_PerfFormattedData_RemoteAccess_RASTotal 
Wmic Path Win32_PerfFormattedData_RSVP_ACSRSVPInterfaces 
Wmic Path Win32_PerfFormattedData_RSVP_ACSRSVPService 
Wmic Path Win32_PerfFormattedData_SMTPSVC_SMTPServer 
Wmic Path Win32_PerfFormattedData_Spooler_PrintQueue 
Wmic Path Win32_PerfFormattedData_TapiSrv_Telephony 
Wmic Path Win32_PerfFormattedData_Tcpip_ICMP 
Wmic Path Win32_PerfFormattedData_Tcpip_IP 
Wmic Path Win32_PerfFormattedData_Tcpip_NBTConnection 
Wmic Path Win32_PerfFormattedData_Tcpip_NetworkInterface 
Wmic Path Win32_PerfFormattedData_Tcpip_TCP 
Wmic Path Win32_PerfFormattedData_Tcpip_UDP 
Wmic Path Win32_PerfFormattedData_TermService_TerminalServices 
Wmic Path Win32_PerfFormattedData_TermService_TerminalServicesSession 
Wmic Path Win32_PerfFormattedData_W3SVC_WebService 
Wmic Path Win32_PerfRawData 
Wmic Path Win32_PerfRawData_ASP_ActiveServerPages 
Wmic Path Win32_PerfRawData_ContentFilter_IndexingServiceFilter 
Wmic Path Win32_PerfRawData_ContentIndex_IndexingService 
Wmic Path Win32_PerfRawData_InetInfo_InternetInformationServicesGlobal 
Wmic Path Win32_PerfRawData_ISAPISearch_HttpIndexingService 
Wmic Path Win32_PerfRawData_MSDTC_DistributedTransactionCoordinator 
Wmic Path Win32_PerfRawData_NTFSDRV_SMTPNTFSStoreDriver 
Wmic Path Win32_PerfRawData_PerfDisk_LogicalDisk 
Wmic Path Win32_PerfRawData_PerfDisk_PhysicalDisk 
Wmic Path Win32_PerfRawData_PerfNet_Browser 
Wmic Path Win32_PerfRawData_PerfNet_Redirector 
Wmic Path Win32_PerfRawData_PerfNet_Server 
Wmic Path Win32_PerfRawData_PerfNet_ServerWorkQueues 
Wmic Path Win32_PerfRawData_PerfOS_Cache 
Wmic Path Win32_PerfRawData_PerfOS_Memory 
Wmic Path Win32_PerfRawData_PerfOS_Objects 
Wmic Path Win32_PerfRawData_PerfOS_PagingFile 
Wmic Path Win32_PerfRawData_PerfOS_Processor 
Wmic Path Win32_PerfRawData_PerfOS_System 
Wmic Path Win32_PerfRawData_PerfProc_FullImage_Costly 
Wmic Path Win32_PerfRawData_PerfProc_Image_Costly 
Wmic Path Win32_PerfRawData_PerfProc_JobObject 
Wmic Path Win32_PerfRawData_PerfProc_JobObjectDetails 
Wmic Path Win32_PerfRawData_PerfProc_Process 
Wmic Path Win32_PerfRawData_PerfProc_ProcessAddressSpace_Costly 
Wmic Path Win32_PerfRawData_PerfProc_Thread 
Wmic Path Win32_PerfRawData_PerfProc_ThreadDetails_Costly 
Wmic Path Win32_PerfRawData_PSched_PSchedFlow 
Wmic Path Win32_PerfRawData_PSched_PSchedPipe 
Wmic Path Win32_PerfRawData_RemoteAccess_RASPort 
Wmic Path Win32_PerfRawData_RemoteAccess_RASTotal 
Wmic Path Win32_PerfRawData_RSVP_ACSRSVPInterfaces 
Wmic Path Win32_PerfRawData_RSVP_ACSRSVPService 
Wmic Path Win32_PerfRawData_SMTPSVC_SMTPServer 
Wmic Path Win32_PerfRawData_Spooler_PrintQueue 
Wmic Path Win32_PerfRawData_TapiSrv_Telephony 
Wmic Path Win32_PerfRawData_Tcpip_ICMP 
Wmic Path Win32_PerfRawData_Tcpip_IP 
Wmic Path Win32_PerfRawData_Tcpip_NBTConnection 
Wmic Path Win32_PerfRawData_Tcpip_NetworkInterface 
Wmic Path Win32_PerfRawData_Tcpip_TCP 
Wmic Path Win32_PerfRawData_Tcpip_UDP 
Wmic Path Win32_PerfRawData_TermService_TerminalServices 
Wmic Path Win32_PerfRawData_TermService_TerminalServicesSession 
Wmic Path Win32_PerfRawData_W3SVC_WebService 
Wmic Path Win32_PhysicalMedia 
Wmic Path Win32_PhysicalMemory 
Wmic Path Win32_PhysicalMemoryArray 
Wmic Path Win32_PhysicalMemoryLocation 
Wmic Path Win32_PingStatus 
Wmic Path Win32_PnPAllocatedResource 
Wmic Path Win32_PnPDevice 
Wmic Path Win32_PnPEntity 
Wmic Path Win32_PnPSignedDriver 
Wmic Path Win32_PnPSignedDriverCIMDataFile 
Wmic Path Win32_PointingDevice 
Wmic Path Win32_PortableBattery 
Wmic Path Win32_PortConnector 
Wmic Path Win32_PortResource 
Wmic Path Win32_POTSModem 
Wmic Path Win32_POTSModemToSerialPort 
Wmic Path Win32_PowerManagementEvent 
Wmic Path Win32_Printer 
Wmic Path Win32_PrinterConfiguration 
Wmic Path Win32_PrinterController 
Wmic Path Win32_PrinterDriver 
Wmic Path Win32_PrinterDriverDll 
Wmic Path Win32_PrinterSetting 
Wmic Path Win32_PrinterShare 
Wmic Path Win32_PrintJob 
Wmic Path Win32_PrivilegesStatus 
Wmic Path Win32_Process 

::::::AttachDebugger Method of the Win32_Process Class 
::::::Create Method of the Win32_Process Class 
::::::GetOwner Method of the Win32_Process Class 
::::::GetOwnerSid Method of the Win32_Process Class 
::::::SetPriority Method of the Win32_Process Class 
::::::Terminate Method of the Win32_Process Class 

Wmic Path Win32_Processor 
Wmic Path Win32_ProcessStartTrace 
Wmic Path Win32_ProcessStartup 
Wmic Path Win32_ProcessStopTrace 
Wmic Path Win32_ProcessTrace 
Wmic Path Win32_Product 
Wmic Path Win32_ProductCheck 
Wmic Path Win32_ProductResource 
Wmic Path Win32_ProductSoftwareFeatures 
Wmic Path Win32_ProgIDSpecification 
Wmic Path Win32_ProgramGroup 
Wmic Path Win32_ProgramGroupContents 
Wmic Path Win32_ProgramGroupOrItem 
Wmic Path Win32_Property 
Wmic Path Win32_ProtocolBinding 
Wmic Path Win32_Proxy 
Wmic Path Win32_PublishComponentAction 
Wmic Path Win32_QuickFixEngineering 
Wmic Path Win32_QuotaSetting 
Wmic Path Win32_Refrigeration 
Wmic Path Win32_Registry 
Wmic Path Win32_RegistryAction 
Wmic Path Win32_RemoveFileAction 
Wmic Path Win32_RemoveIniAction 
Wmic Path Win32_ReserveCost 
Wmic Path Win32_ScheduledJob 
Wmic Path Win32_SCSIController 
Wmic Path Win32_SCSIControllerDevice 
Wmic Path Win32_SecurityDescriptor 
Wmic Path Win32_SecurityDescriptorHelper 
Wmic Path Win32_SecuritySetting 
Wmic Path Win32_SecuritySettingAccess 
Wmic Path Win32_SecuritySettingAuditing 
Wmic Path Win32_SecuritySettingGroup 
Wmic Path Win32_SecuritySettingOfLogicalFile 
Wmic Path Win32_SecuritySettingOfLogicalShare 
Wmic Path Win32_SecuritySettingOfObject 
Wmic Path Win32_SecuritySettingOwner 
Wmic Path Win32_SelfRegModuleAction 
Wmic Path Win32_SerialPort 
Wmic Path Win32_SerialPortConfiguration 
Wmic Path Win32_SerialPortSetting 
Wmic Path Win32_ServerConnection 
Wmic Path Win32_ServerSession 
Wmic Path Win32_Service 
Wmic Path Win32_ServiceControl 
Wmic Path Win32_ServiceSpecification 
Wmic Path Win32_ServiceSpecificationService 
Wmic Path Win32_Session 
Wmic Path Win32_SessionConnection 
Wmic Path Win32_SessionProcess 
Wmic Path Win32_SettingCheck 
Wmic Path Win32_ShadowBy 
Wmic Path Win32_ShadowContext 
Wmic Path Win32_ShadowCopy 
Wmic Path Win32_ShadowDiffVolumeSupport 
Wmic Path Win32_ShadowFor 
Wmic Path Win32_ShadowOn 
Wmic Path Win32_ShadowProvider 
Wmic Path Win32_ShadowStorage 
Wmic Path Win32_ShadowVolumeSupport 
Wmic Path Win32_Share 
Wmic Path Win32_ShareToDirectory 
Wmic Path Win32_ShortcutAction 
Wmic Path Win32_ShortcutFile 
Wmic Path Win32_ShortcutSAP 
Wmic Path Win32_SID 
Wmic Path Win32_SIDandAttributes 
Wmic Path Win32_SMBIOSMemory 
Wmic Path Win32_SoftwareElement 
Wmic Path Win32_SoftwareElementAction 
Wmic Path Win32_SoftwareElementCheck 
Wmic Path Win32_SoftwareElementCondition 
Wmic Path Win32_SoftwareElementResource 
Wmic Path Win32_SoftwareFeature 
Wmic Path Win32_SoftwareFeatureAction 
Wmic Path Win32_SoftwareFeatureCheck 
Wmic Path Win32_SoftwareFeatureParent 
Wmic Path Win32_SoftwareFeatureSoftwareElements 
Wmic Path Win32_SoundDevice 
Wmic Path Win32_StartupCommand 
Wmic Path Win32_SubDirectory 
Wmic Path Win32_SystemAccount 
Wmic Path Win32_SystemBIOS 
Wmic Path Win32_SystemBootConfiguration 
Wmic Path Win32_SystemConfigurationChangeEvent 
Wmic Path Win32_SystemDesktop 
Wmic Path Win32_SystemDevices 
Wmic Path Win32_SystemDriver 
Wmic Path Win32_SystemDriverPnPEntity 
Wmic Path Win32_SystemEnclosure 
Wmic Path Win32_SystemLoadOrderGroups 
Wmic Path Win32_SystemLogicalMemoryConfiguration 
Wmic Path Win32_SystemMemoryResource 
Wmic Path Win32_SystemNetworkConnections 
Wmic Path Win32_SystemOperatingSystem 
Wmic Path Win32_SystemPartitions 
Wmic Path Win32_SystemProcesses 
Wmic Path Win32_SystemProgramGroups 
Wmic Path Win32_SystemResources 
Wmic Path Win32_SystemServices 
Wmic Path Win32_SystemSetting 
Wmic Path Win32_SystemSlot 
Wmic Path Win32_SystemSystemDriver 
Wmic Path Win32_SystemTimeZone 
Wmic Path Win32_SystemTrace 
Wmic Path Win32_SystemUsers 
Wmic Path Win32_TapeDrive 
Wmic Path Win32_TCPIPPrinterPort 
Wmic Path Win32_TemperatureProbe 
Wmic Path Win32_Thread 
Wmic Path Win32_ThreadStartTrace 
Wmic Path Win32_ThreadStopTrace 
Wmic Path Win32_ThreadTrace 
Wmic Path Win32_TimeZone 
Wmic Path Win32_TokenGroups 
Wmic Path Win32_TokenPrivileges 
Wmic Path Win32_Trustee 
Wmic Path Win32_TypeLibraryAction 
Wmic Path Win32_UninterruptiblePowerSupply 
Wmic Path Win32_USBController 
Wmic Path Win32_USBControllerDevice 
Wmic Path Win32_USBHub 
Wmic Path Win32_UserAccount 
Wmic Path Win32_UserDesktop 
Wmic Path Win32_UserInDomain 
Wmic Path Win32_UTCTime 
Wmic Path Win32_VideoConfiguration 
Wmic Path Win32_VideoController 
Wmic Path Win32_VideoSettings 
Wmic Path Win32_VoltageProbe 
Wmic Path Win32_Volume 
Wmic Path Win32_VolumeChangeEvent 
Wmic Path Win32_VolumeQuota 
Wmic Path Win32_VolumeQuotaSetting 
Wmic Path Win32_VolumeUserQuota 
Wmic Path Win32_WindowsProductActivation 
Wmic Path Win32_WMIElementSetting 
Wmic Path Win32_WMISetting  
 
手把手教你如何Get筛选类型

有了上面一些命令后,执行后窗口显示的往往是乱七八糟大部分都是些不想要的信息,这时我们就要筛选出自己想要的内容了。
—————————————————————————————————————————————

例子:
遍历本地磁盘信息,筛选只显示“文件系统”“驱动器类型”“盘符”其他乱七八糟的一概不显示
步骤1: WMIC Path Win32_LogicalDisk>tmp.txt得到的一个乱七八糟的磁盘信息文本
步骤2: 打开tmp.txt会看到下面内容,因为篇幅不够这里就只贴部分内容了
           Description                DeviceID   FileSystem  FreeSpace     ........ 
           3 1/2 英寸软盘驱动器  A:                                                  ........
           本地固定磁盘             C:            NTFS         1521709056 ........
           本地固定磁盘             D:            NTFS         4812705792 ........
           本地固定磁盘             E:            FAT32        2951413760 ........
           CD-ROM 磁盘             F:                                                 ........
           CD-ROM 磁盘             G:           CDFS          0               ........ 
步骤3:如上所示红色部分就是分支节点名称,这样我们可以用Get去筛选了,开始输入命令
        WMIC Path Win32_LogicalDisk Get Description,DeviceID,FileSystem
好了屏幕显示的内容是不是很整齐啊,如果想分行显示可以在命令后面加/format:list


用for遍历所有本地磁盘盘符到%Disk%变量例子

--------------------------------------------------------------------------------

@echo off
for /f "skip=2 tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get Description^,DeviceID^,FileSystem /format:csv^|findstr /i /v "英寸 CD-ROM"') do call set Disk=%%Disk%% %%i
set Disk=%Disk:~1%
echo %Disk%
pause
遍历所有本地FAT32文件系统磁盘盘符到%FATDisk%变量例子

--------------------------------------------------------------------------------

@echo off
for /f "skip=2 tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get Description^,DeviceID^,FileSystem /format:csv^|findstr /i /v "英寸 CD-ROM 移动 NTFS"') do call set FATDisk=%%FATDisk%% %%i
set FATDisk=%FATDisk:~1%
echo %FATDisk%
pause
遍历所有本地可移动磁盘盘符到%USBDisk%变量例子

--------------------------------------------------------------------------------

@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,FileSystem^,Description /format:csv^|find /i "移动"') do call set USBDisk=%%USBDisk%% %%i
echo %USBDisk:~1%
pause
遍历所有本地CD-ROM盘符到%CDROM%变量例子

--------------------------------------------------------------------------------

@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,FileSystem^,Description /format:csv^|find /i "CD-ROM"') do call set CDROM=%%CDROM%% %%i
echo %CDROM:~1%
pause
遍历非闲置(有光盘的)CD-ROM盘符到%CDROM%变量例子

--------------------------------------------------------------------------------

@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,FileSystem^,Description /format:csv^|find /i "CD-ROM"^|find "CDFS"') do call set CDROM=%%CDROM%% %%i
echo %CDROM:~1%
pause
遍历移动硬盘盘符到%RemovalDisk%变量例子(非U盘)

--------------------------------------------------------------------------------

@echo off
for /f "tokens=3* delims=," %%i in ('WMIC Path Win32_LogicalDisk Get DeviceID^,VolumeDirty^,Description /format:csv^|find /i "TRUE"') do call set RemovalDisk=%%RemovalDisk%% %%i
if not "%RemovalDisk%"==""  echo %RemovalDisk:~1%
pause

WMI命令行示例(某某同志看到下面示例比较眼熟别埋怨我^_^)
BIOS  - 基本输入/输出服务 (BIOS) 管理
::查看bios版本型号
wmic bios get Manufacturer,Name

COMPUTERSYSTEM - 计算机系统管理
::查看系统启动选项,boot的内容
wmic COMPUTERSYSTEM get SystemStartupOptions
::查看工作组/域
wmic computersystem get domain
::更改计算机名abc为123
wmic computersystem where "name='abc'" call rename 123
::更改工作组google为MyGroup
wmic computersystem where "name='google'" call joindomainorworkgroup "","","MyGroup",1

CPU - CPU 管理
::查看cpu型号
wmic cpu get name

DATAFILE - DataFile 管理
::查找e盘下test目录(不包括子目录)下的cc.cmd文件
wmic datafile where "drive='e:' and path='\\test\\' and FileName='cc' and Extension='cmd'" list
::查找e盘下所有目录和子目录下的cc.cmd文件,且文件大小大于1K
wmic datafile where "drive='e:' and FileName='cc' and Extension='cmd' and FileSize>'1000'" list
::删除e盘下文件大小大于10M的.cmd文件
wmic datafile where "drive='e:' and Extension='cmd' and FileSize>'10000000'" call delete
::删除e盘下test目录(不包括子目录)下的非.cmd文件
wmic datafile where "drive='e:' and Extension<>'cmd' and path='test'" call delete
::复制e盘下test目录(不包括子目录)下的cc.cmd文件到e:\,并改名为aa.bat
wmic datafile where "drive='e:' and path='\\test\\' and FileName='cc' and Extension='cmd'" call copy "e:\aa.bat"
::改名c:\hello.txt为c:\test.txt
wmic datafile "c:\\hello.txt" call rename c:\test.txt
::查找h盘下目录含有test,文件名含有perl,后缀为txt的文件
wmic datafile where "drive='h:' and extension='txt' and path like '%\\test\\%' and filename like '%perl%'" get name

DESKTOPMONITOR - 监视器管理
::获取屏幕分辨率
wmic DESKTOPMONITOR where Status='ok' get ScreenHeight,ScreenWidth

DISKDRIVE  - 物理磁盘驱动器管理
::获取物理磁盘型号大小等
wmic DISKDRIVE get Caption,size,InterfaceType

ENVIRONMENT  - 系统环境设置管理
::获取temp环境变量
wmic ENVIRONMENT where "name='temp'" get UserName,VariableValue
::更改path环境变量值,新增e:\tools
wmic ENVIRONMENT where "name='path' and username='<system>'" set VariableValue="%path%;e:\tools"
::新增系统环境变量home,值为%HOMEDRIVE%%HOMEPATH%
wmic ENVIRONMENT create name="home",username="<system>",VariableValue="%HOMEDRIVE%%HOMEPATH%"
::删除home环境变量
wmic ENVIRONMENT where "name='home'" delete

FSDIR  - 文件目录系统项目管理
::查找e盘下名为test的目录
wmic FSDIR where "drive='e:' and filename='test'" list
::删除e:\test目录下除过目录abc的所有目录
wmic FSDIR where "drive='e:' and path='\\test\\' and filename<>'abc'" call delete
::删除c:\good文件夹
wmic fsdir "c:\\good" call delete
::重命名c:\good文件夹为abb
wmic fsdir "c:\\good" rename "c:\abb"

LOGICALDISK  - 本地储存设备管理
::获取硬盘系统格式、总大小、可用空间等
wmic LOGICALDISK get name,Description,filesystem,size,freespace

NIC - 网络界面控制器 (NIC) 管理

OS  - 已安装的操作系统管理
::设置系统时间
wmic os where(primary=1) call setdatetime 20070731144642.555555+480

PAGEFILESET  - 页面文件设置管理
::更改当前页面文件初始大小和最大值
wmic PAGEFILESET set InitialSize="512",MaximumSize="512"
::页面文件设置到d:\下,执行下面两条命令
wmic pagefileset create name='d:\pagefile.sys',initialsize=512,maximumsize=1024
wmic pagefileset where"name='c:\\pagefile.sys'" delete

PROCESS - 进程管理
::列出进程的核心信息,类似任务管理器
wmic process list brief
::结束svchost.exe进程,路径为非C:\WINDOWS\system32\svchost.exe的
wmic process where "name='svchost.exe' and ExecutablePath<>'C:\\WINDOWS\\system32\\svchost.exe'" call Terminate
::新建notepad进程
wmic process call create notepad

PRODUCT - 安装包任务管理
::安装包在C:\WINDOWS\Installer目录下
::卸载.msi安装包
wmic PRODUCT where "name='Microsoft .NET Framework 1.1' and Version='1.1.4322'" call Uninstall
::修复.msi安装包
wmic PRODUCT where "name='Microsoft .NET Framework 1.1' and Version='1.1.4322'" call Reinstall

SERVICE - 服务程序管理
::运行spooler服务
wmic SERVICE where name="Spooler" call startservice
::停止spooler服务
wmic SERVICE where name="Spooler" call stopservice
::暂停spooler服务
wmic SERVICE where name="Spooler" call PauseService
::更改spooler服务启动类型[auto|Disabled|Manual] 释[自动|禁用|手动]
wmic SERVICE where name="Spooler" set StartMode="auto"
::删除服务
wmic SERVICE where name="test123" call delete

SHARE - 共享资源管理
::删除共享
wmic SHARE where name="e$" call delete
::添加共享
WMIC SHARE CALL Create "","test","3","TestShareName","","c:\test",0

SOUNDDEV - 声音设备管理
wmic SOUNDDEV list

STARTUP - 用户登录到计算机系统时自动运行命令的管理
::查看msconfig中的启动选项
wmic STARTUP list

SYSDRIVER  - 基本服务的系统驱动程序管理
wmic SYSDRIVER list

USERACCOUNT  - 用户帐户管理
::更改用户administrator全名为admin
wmic USERACCOUNT where name="Administrator" set FullName="admin"
::更改用户名admin为admin00
wmic useraccount where "name='admin" call Rename admin00

Datafile 别名
wmic datafile "c:\\hello.txt" call rename c:\ppp.txt

wmic datafile Where "drive='d:' and extension='txt' and path='\\'" get name
WMIC FSDIR别名

wmic fsdir where(name='c:\\good') delete
wmic fsdir where(name='c:\\good') call delete
删除c:\good文件夹

wmic fsdir where(name='c:\\good') rename "c:\abb"
重命名c:\good文件夹为abb

复制文件夹
wmic fsdir where(name='d:\\test') call copy "c:\ppcd"
复制D盘下TEST文件夹的所有文件到C盘下的PPCD,如果PPCD存在直接复制过去,如果不存在他会自动创建并将文件复制过去
wmic fsdir where(name='d:\\test') call Compress
压缩指定文件夹,以便节省磁盘空间
wmic fsdir where(name='d:\\test') call unCompress

解除压缩文件夹
Job 别名
wmic job call create "sol.exe",0,0,1,0,********154600.000000+480

这个命令和AT命令是一模一样啊,AT添加的计划任务他可以看到,他添加的同样AT命令也是可以看到
wmic job call create "sol.exe",0,0,true,false,********154800.000000+480
wmic job call create "sol.exe",0,0,1,0,********154600.000000+480
这两句是相同的,TRUE可以用1表示,同样的FALSE可以用0值表示,时间前为何用八个星号,这是WMIC的特性,他显示时间的方式是YYYYMMDDHHMMSS.MMMMMM+时区 ,可是,我们并不需要指定年份和月份还有天,所以用*星号来替代

Os 别名
wmic os Where (primary='1') call win32shutdown *
这个*参数可以有如下值:
Const LOGOFF=0
Const SHUTDOWN=1
Const REBOOT=2
Const FORCE=4
Const POWEROFF=8
这些参数可以进行任意组合,例如:
强制注销:4 (0+4)的组合
强制关机:5 (1+4)的组合
强制重启:6 (2+4)的组合
强制关闭电源:12 (8+4)的组合

WMIC设置系统时间
要求需要有管理员权限
wmic os where(primary=1) call setdatetime 20070731144642.555555+480

Process 别名
wmic process call create sol.exe
wmic process 3848 call terminate
可以看出PROCESS别名是以HANDLE属性为默认属性进行操作的
wmic process 2556 call setpriority 64
wmic process Where "processid='%pid%'" call Terminate
wmic process Where "name='%imagename%'" call Terminate
wmic path Win32_Process.name="%imagename%" call Terminate
wmic path Win32_Process.processid="%pid%" call Terminate
wmic process Where name='sol.exe' delete

Nicconfig 别名
wmic nicconfig where(index='8') call enablestatic "192.168.1.81","255.255.255.0"   
设置IP地址和子网掩码
wmic nicconfig where(index='8') call setgateways "192.168.0.1",1          
设置网关和跃点数
wmic nicconfig where(index='8') call setdnsdomain ("192.168.0.1","192.168.0.11")  
设置DNS服务器地址,设置完毕后不会马上生效,必需要设置主次才可以生效
wmic nicconfig where(index='8') call SetDNSServerSearchOrder ("192.168.0.1","192.168.0.11") 
设置DNS服务器地址的主次顺序,192.168.0.1在前表示为首选DNS地址,在后为备用DNS地址
wmic path Win32_NetworkAdapterConfiguration.index=8 call enabledhcp
WMIC默认的NICCONFIG别名是不提供enabledhcp这个方法的,所以我们只能调用他的WMI函数来设置动态分配IP地址的设置
wmic nicconfig where(index='8') get /value ###INDEX值为你当前网卡的索引值,每台机器都不一样

WMIC对注册表的操作
wmic /namespace:\\root\default path stdregprov call getstringvalue ^&H80000002,"SOFTWARE\libowen","hello"
wmic /namespace:\\root\default path stdregprov call createkey ^&h80000001,"libowen\good"
建立libowen\good 这个键值
wmic /namespace:\\root\default path stdregprov call deletekey ^&h80000001,"libowen\sdd"  
删除键值SDD,注意此键值必须是最底层
wmic /namespace:\\root\default path stdregprov call EnumKey ^&h80000001,"Keyboard Layout"
枚举Keyboard Layout下的所有子键值
wmic /namespace:\\root\default path stdregprov call Enumvalues ^&h80000001,"Keyboard Layout\preload"
枚举Keyboard Layout\preload这个键值下的所有数值及其数值所对应的类型
wmic /namespace:\\root\default path stdregprov call SetStringValue ^&h80000001,"libowen\test","hello world!","test"
建立一个名为test的string的数值,值为hello world!
wmic /namespace:\\root\default path stdregprov call SetStringValue ^&h80000001,"libowen\test","test","aabb"
修改aabb的数值为test


Pagefileset 别名
wmic pagefileset get /value
用来察看本地计算机虚拟内存情况,初始大小,最大值,保存位置等
下面我们可以改变虚拟内存文件(也就是我们常说的页面文件) 所在位置以及初始大小和最大值
wmic pagefileset set initialsize=512,maximumsize=1024
这个只是改变初始大小和最大值,SET不能修改页面文件所存放的位置,也就是说默认页面文件在C盘这时不能把他的位置修改到D盘,如果要修改到D盘我们可以这样来做
wmic pagefileset create name='d:\pagefile.sys',initialsize=512,maximumsize=1024
然后删除以前的就可以了,请看
wmic pagefileset where "name='c:\\pagefile.sys'"  delete
这样就实现了把页面文件转移到D盘的效果

WMIC设置代理服务器
wmic path win32_proxy get /value
wmic path win32_proxy Where ServerName='ql-libowen.ql-art.com' call setproxysetting "8080","192.168.1.59"
wmic path win32_proxy.servername="ql-libowen.ql-art.com" call setproxysetting "",""

WMIC 设置共享
输入参数是 OBJECT 类型
原因:对于 OBJECT 类型的输入参数,还没有实现全面支持。默认值(空字符串:"")是目前支持的唯一值。
解决方案:使用下面的命令为三个用户设置 c:\test 目录的共享:
WMIC SHARE CALL Create "","test","3","TestShareName","","c:\test",0

建立共享文件夹
WMIC SHARE where(path='c:\\test') call delete

WMIC对于共享文件夹操作
WMIC SHARE where(path='c:\\test') delete

Computersystem 别名
wmic computersystem Where "name='原计算机名称'" call rename "要修改的计算机名"
主要功能:修改计算机名称
wmic computersystem Where "name='计算机名称'" call joindomainorworkgroup "","","MyGroup"
主要功能:更改现有工作组为指定的工作组
wmic computersystem Where "name='计算机名称' call UnjoinDomainOrWorkgroup
主要功能:退出所在域
wmic computersystem Where "name='计算机名称'" call joindomainorworkgroup "",1,"域名称","域管理员密码","域管理员用户名"

Useraccount 别名
wmic useraccount where(LocalAccount='1' and name='good') set disabled=true
wmic useraccount where(LocalAccount='1' and name='good') set fullname="hello world!"
wmic useraccount where(localaccount=true and name='good') set passwordchangeable=true
wmic useraccount Where "domain='ql-libowen' and name='libowen'" set PasswordExpires=false 
View Code

 

 

 微软官方最齐全的 WMI VBScript 实例 Scriptomatic 2.0

 windows脚本教程:Managing Windows with VBScript and WMI.chm

 

开启远程计算机的远程桌面(注意关闭远程防火墙)

通过注册表,远程连接到远端计算机,找到 HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server,在Terminal Server键下,名为fDenyTSConnection的REG_DWORD型键值。双击这个键值打开“编辑DWORD值”对话框,把1(禁用远程桌面)改成0(启用远程桌面)

判断远端计算机WMI服务是否正常的方法

wmic /user:username /password:yourpassword   /node:remotemachine systemenclosure get serialnumber

如果得到的结果如下,则远端WMI是正常服务的。

Serial Number

W23HN769U-9 (the serial number from the machine)

 

wmic /node:192.168.1.3 /user:administrator path win32_terminalservicesetting where (servername!="") call setallowtsconnections 1
wmic /node:192.168.1.3 /user:administrator path win32_terminalservicesetting where (__Class!="") call setallowtsconnections 1

 

 

参考:

http://www.bathome.net/viewthread.php?tid=4068#pid25946

http://www.bathome.net/thread-4068-1-1.html

http://www.bathome.net/thread-420-1-1.html

http://www.bathome.net/thread-534-1-1.html

http://www.bathome.net/thread-377-1-1.html 

Windows WMIC命令使用详解(附实例)

 https://www.computerperformance.co.uk/

posted @ 2018-07-22 19:41  磨叽开发者  阅读(5970)  评论(0编辑  收藏  举报