獲取BIOS序列號php
wmic bios list full | find "SerialNumber"
SerialNumber=P50168VBhtml
獲取CPUID(WIN32_PROCESSOR)node
wmic cpu list full | find "ProcessorId"
rem 提取CPU名稱和描述的批處理語句ios
@echo off
for /f "delims=" %%a in ('wmic cpu get name^,description /value^|findstr "="') do set "%%a"
echo;%name%
echo;%description%windows
ProcessorId=BFEBFBFF000306B9api
獲取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
系統信息獲取例子app
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
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