有各种各样的命令WMIC
可以接受,例如
WMIC Path Win32_Battery
WMIC Path Win32_Processor
WMIC Class Win32_Battery
WMIC Class ComputerSystem
等等。
有什么办法列表所有这些潜在的“路径”和“类”等等都来自命令行?
答案1
当您在此处列出它们时,您正在请求 WMI 对象类的列表(主要来自 Win32 部分);“路径”可以是那个,那个加上子节点,那个加上子节点加上值等等。看这里:
从概念上讲,WMI 对象路径类似于统一资源定位器 (URL),它是一个字符串,用于唯一标识服务器上的命名空间、命名空间内的类或类的实例
哪些类可用将取决于 Windows 的版本(除其他因素外,因为我相信自定义 WMI 类可以在 WMI 系统内注册),因此您不能假设所有类都适用于所有版本的 Windows。
话说回来:
我不知道如何从常用命令行列出它们。使用电源外壳您可以使用以下命令获取 Win32 WMI 类的完整列表:
Get-WMIObject -List| Where{$_.name -match "^Win32_"} | Sort Name | Format-Table Name
您还应该能够使用 Windows 脚本(即:VBScript)来获取它。
Win32 是大约 10 个不同类别之一。
您可以获取当前 WMI 部分/类/方法/属性来自 MS 的 MSDN 页面的列表。
以下是 (大多数) Win32 WMI 类的列表:
- Win32_1394控制器
- Win32_1394控制器设备
- Win32_AccountSID
- Win32_ActionCheck
- Win32_ActiveRoute
- Win32_AllocatedResource
- Win32_应用程序命令行
- Win32_应用程序服务
- Win32_AssociatedBattery
- Win32_AssociatedProcessorMemory
- Win32_Autochk设置
- Win32_BaseBoard
- Win32_电池
- Win32_二进制
- Win32_BindImageAction
- BIOS 驱动程序
- Win32_启动配置
- Win32_总线 Win32_缓存内存
- Win32_CDROM驱动器
- Win32_Check检查
- Win32_CIMLogicalDeviceCIMDataFile
- Win32_ClassicCOM应用程序类
- Win32_ClassicCOMClass
- Win32_ClassicCOMClassSetting
- Win32_ClassicCOMClassSettings
- Win32_ClassInforAction
- Win32_客户端应用程序设置
- Win32_Codec文件
- Win32_COM应用程序设置
- Win32_COMClassAutoEmulator
- 类库
- Win32_命令行访问
- Win32_组件类别
- Win32_计算机系统
- Win32_ComputerSystem处理器
- Win32_计算机系统产品
- Win32_ComputerSystemWindowsProductActivationSetting
- Win32_条件
- Win32_连接共享
- Win32_ControllerHastHub
- Win32_CreateFolderAction
- Win32_CurrentProbe
- Win32_DCOM应用程序
- Win32_DCOM应用程序访问允许设置
- Win32_DCOMApplicationLaunchAllowedSetting
- Win32_DCOM应用程序设置
- Win32_DependentService
- Win32_桌面
- Win32_桌面监视器
- Win32_设备总线
- Win32_设备内存地址
- Win32_目录
- Win32_目录规范
- Win32_磁盘驱动器
- Win32_磁盘驱动器物理媒体
- Win32_磁盘驱动器到磁盘分区
- Win32_磁盘分区
- Win32_磁盘配额
- Win32_显示配置
- Win32_DisplayController配置
- Win32_DMAChanner
- 驱动程序
- 驱动程序VXD
- Win32_DuplicateFileAction
- Win32_环境
- Win32_环境规范
- Win32_扩展信息操作
- 温32_范
- Win32_文件规范
- Win32_FloppyController
- Win32_软盘驱动器
- Win32_FontInfoAction
- Win32_组
- Win32_GroupDomain
- Win32_GroupUser
- Win32_热管
- Win32_IDE控制器
- Win32_IDE控制器设备
- Win32_ImplementedCategory
- Win32_红外设备
- Win32_IniFile规范
- Win32_InstalledSoftwareElement
- Win32_IP4PersistedRouteTable
- Win32_IP4路由表
- Win32_IRQ资源
- Win32_键盘
- Win32_LaunchCondition
- 加载顺序组
- Win32_LoadOrderGroupServiceDependencies
- Win32_LoadOrderGroupServiceMembers
- Win32_本地时间
- Win32_LoggedOnUser
- Win32_逻辑磁盘
- Win32_LogicalDiskRoot目录
- Win32_LogicalDiskToPartition
- Win32_LogicalFileAccess
- Win32_LogicalFileAuditing
- Win32_逻辑文件组
- Win32_LogicalFileOwner
- Win32_LogicalFileSecuritySetting
- Win32_LogicalMemory配置
- Win32_逻辑程序组
- Win32_LogicalProgramGroup目录
- Win32_LogicalProgramGroupItem
- Win32_LogicalProgramGroupItem数据文件
- Win32_LogicalShareAccess
- Win32_LogicalShareAuditing
- Win32_LogicalShareSecuritySetting
- Win32_Logon会话
- Win32_LogonSessionMappedDisk
- Win32_MappedLogicalDisk
- Win32_MemoryArray
- Win32_MemoryArrayLocation
- Win32_内存设备
- Win32_MemoryDeviceArray
- Win32_MemoryDeviceLocation
- Win32_MIMEInfoAction
- Win32_主板设备
- Win32_移动文件操作
- 命名作业对象
- Win32_NamedJobObjectActgInfo
- Win32_NamedJobObjectLimit
- Win32_NamedJobObjectLimitSetting
- Win32_NamedJobObjectProcess
- Win32_NamedJobObjectSecLimit
- Win32_NamedJobObjectSecLimit设置
- Win32_NamedJobObjectStatistics
- Win32_网络适配器
- Win32_网络适配器配置
- Win32_网络适配器设置
- Win32_网络客户端
- Win32_网络连接
- Win32_NetworkLogin 配置文件
- Win32_网络协议
- Win32_NT域
- Win32_NT事件日志文件
- Win32_NTLog事件
- 事件计算机
- Win32_NTLogEvnetLog
- Win32_NTLogEventUser
- Win32_ODBC属性
- Win32_ODBCDataSource属性
- Win32_ODBC数据源规范
- Win32_ODBCDriverAttribute
- Win32_ODBC 驱动程序软件元素
- Win32_ODBC 驱动程序规范
- Win32_ODBCSource属性
- Win32_ODBCTranslator 规范
- Win32_OnBoard 设备
- Win32_操作系统
- Win32_操作系统Autochk设置
- Win32_操作系统QFE
- Win32_OSRecovery配置
- Win32 页面文件
- Win32_PageFileElement设置
- Win32_PageFileSetting
- Win32_PageFileUsage
- Win32_并行端口
- Win32_补丁
- Win32 补丁文件
- Win32_补丁包
- Win32_PCMCIA控制器
- 函数库
- Win32_PerfFormattedData_ASPNET_114322_ASPNETAppsv114322
- Win32_PerfFormattedData_ASPNET_114322_ASPNETv114322
- Win32_PerfFormattedData_ASPNET_2040607_ASPNETAppsv2040607
- Win32_PerfFormattedData_ASPNET_2040607_ASPNETv2040607
- Win32_PerfFormattedData_ASPNET_ASPNET
- Win32_PerfFormattedData_ASPNET_ASPNET应用程序
- Win32_PerfFormattedData_aspnet_state_ASPNETStateService
- Win32_PerfFormattedData_ContentFilter_IndexingServiceFilter
- Win32_PerfFormattedData_ContentIndex_IndexingService
- Win32_PerfFormattedData_DTSPipeline_SQLServerDTSPipeline
- Win32_PerfFormattedData_Fax_FaxServices
- Win32_PerfFormattedData_InetInfo_InternetInformationServices全球
- Win32_PerfFormattedData_ISAPISearch_HttpIndexingService
- Win32_PerfFormattedData_MSDTC_DistributedTransactionCoordinator
- Win32_PerfFormattedData_NETCLRData_NETCLRData
- Win32_PerfFormattedData_NETCLRNetworking_NETCLRNetworking
- Win32_PerfFormattedData_NETDataProviderforOracle_NETCLRData
- Win32_PerfFormattedData_NETDataProviderforSqlServer_NETDataProviderforSqlServer
- Win32_PerfFormattedData_NETFramework_NETCLRExceptions
- Win32_PerfFormattedData_NETFramework_NETCLRInterop
- Win32_PerfFormattedData_NETFramework_NETCLRJit
- Win32_PerfFormattedData_NETFramework_NETCLRLoading
- Win32_PerfFormattedData_NETFramework_NETCLRLocksAndThreads
- Win32_PerfFormattedData_NETFramework_NETCLRMemory
- Win32_PerfFormattedData_NETFramework_NETCLRRemoting
- Win32_PerfFormattedData_NETFramework_NETCLRSecurity
- Win32_PerfFormattedData_NTFSDRV_Controladordealmacenamiento NTFS de SMTP
- Win32_PerfFormattedData_Outlook_Outlook
- Win32_PerfFormattedData_PerfDisk_LogicalDisk
- Win32_PerfFormattedData_PerfDisk_PhysicalDisk
- Win32_PerfFormattedData_PerfNet_Browser
- Win32_PerfFormattedData_PerfNet_重定向器
- Win32_PerfFormattedData_PerfNet_服务器
- Win32_PerfFormattedData_PerfNet_ServerWorkQueues
- Win32_PerfFormattedData_PerfOS_Cache
- Win32_PerfFormattedData_PerfOS_Memory
- Win32_PerfFormattedData_PerfOS_对象
- Win32_PerfFormattedData_PerfOS_PagingFile
- Win32_PerfFormattedData_PerfOS_Processor
- Win32_PerfFormattedData_PerfOS_System
- Win32_PerfFormattedData_PerfProc_FullImage_Costly
- Win32_PerfFormattedData_PerfProc_Image_Costly
- 函数库
- Win32_PerfFormattedData_PerfProc_JobObjectDetails
- Win32_PerfFormattedData_PerfProc_进程
- Win32_PerfFormattedData_PerfProc_ProcessAddressSpace_Costly
- Win32_PerfFormattedData_PerfProc_Thread
- Win32_PerfFormattedData_PerfProc_ThreadDetails_Costly
- Win32_PerfFormattedData_RemoteAccess_RASPort
- Win32_PerfFormattedData_RemoteAccess_RASTotal
- Win32_PerfFormattedData_RSVP_RSVPInterfaces
- Win32_PerfFormattedData_RSVP_RSVPService
- Win32_PerfFormattedData_Spooler_PrintQueue
- Win32_PerfFormattedData_TapiSrv_Telephony
- Win32_PerfFormattedData_Tcpip_ICMP
- Win32_PerfFormattedData_Tcpip_IP
- Win32_PerfFormattedData_Tcpip_NBTConnection
- Win32_PerfFormattedData_Tcpip_网络接口
- Win32_PerfFormattedData_Tcpip_TCP
- Win32_PerfFormattedData_Tcpip_UDP
- Win32_PerfFormattedData_TermService_终端服务
- Win32_PerfFormattedData_TermService_TerminalServicesSession
- Win32_PerfFormattedData_W3SVC_WebService
- 函数库
- Win32_PerfRawData_ASPNET_114322_ASPNETAppsv114322
- Win32_PerfRawData_ASPNET_114322_ASPNETv114322
- Win32_PerfRawData_ASPNET_2040607_ASPNETAppsv2040607
- Win32_PerfRawData_ASPNET_2040607_ASPNETv2040607
- Win32_PerfRawData_ASPNET_ASPNET
- Win32_PerfRawData_ASPNET_ASPNET应用程序
- Win32_PerfRawData_aspnet_state_ASPNETStateService
- Win32_PerfRawData_ContentFilter_IndexingServiceFilter
- Win32_PerfRawData_ContentIndex_IndexingService
- Win32_PerfRawData_DTSPipeline_SQLServerDTSPipeline
- Win32_PerfRawData_Fax_FaxServices
- Win32_PerfRawData_InetInfo_InternetInformationServices全球
- 温32_PerfRawData_ISAPISearch_HttpIndexingService
- Win32_PerfRawData_MSDTC_DistributedTransactionCoordinator
- Win32_PerfRawData_NETCLRData_NETCLRData
- Win32_PerfRawData_NETCLRNetworking_NETCLRNetworking
- Win32_PerfRawData_NETDataProviderforOracle_NETCLRData
- Win32_PerfRawData_NETDataProviderforSqlServer_NETDataProviderforSqlServer
- Win32_PerfRawData_NETFramework_NETCLRExceptions
- Win32_PerfRawData_NETFramework_NETCLRInterop
- Win32_PerfRawData_NETFramework_NETCLRJit
- Win32_PerfRawData_NETFramework_NETCLRLoading
- Win32_PerfRawData_NETFramework_NETCLRLocksAndThreads
- Win32_PerfRawData_NETFramework_NETCLRMemory
- Win32_PerfRawData_NETFramework_NETCLRRemoting
- Win32_PerfRawData_NETFramework_NETCLRSecurity
- Win32_PerfRawData_NTFSDRV_控制从 NTFS 到 SMTP 的交易
- Win32_PerfRawData_Outlook_Outlook
- Win32_PerfRawData_PerfDisk_LogicalDisk
- Win32_PerfRawData_PerfDisk_PhysicalDisk
- Win32_PerfRawData_PerfNet_浏览器
- Win32_PerfRawData_PerfNet_重定向器
- Win32_PerfRawData_PerfNet_服务器
- Win32_PerfRawData_PerfNet_ServerWorkQueues
- Win32_PerfRawData_PerfOS_缓存
- Win32_PerfRawData_PerfOS_内存
- Win32_PerfRawData_PerfOS_对象
- Win32_PerfRawData_PerfOS_PagingFile
- Win32_PerfRawData_PerfOS_处理器
- Win32_PerfRawData_PerfOS_系统
- Win32_PerfRawData_PerfProc_FullImage_Costly
- Win32_PerfRawData_PerfProc_Image_Costly
- 函数库
- Win32_PerfRawData_PerfProc_JobObjectDetails
- Win32_PerfRawData_PerfProc_进程
- Win32_PerfRawData_PerfProc_ProcessAddressSpace_Costly
- Win32_PerfRawData_PerfProc_Thread
- Win32_PerfRawData_PerfProc_ThreadDetails_Costly
- Win32_PerfRawData_RemoteAccess_RASPort
- Win32_PerfRawData_RemoteAccess_RASTotal
- Win32_PerfRawData_RSVP_RSVPInterfaces
- Win32_PerfRawData_RSVP_RSVP服务
- Win32_PerfRawData_Spooler_PrintQueue
- Win32_PerfRawData_TapiSrv_电话
- Win32_PerfRawData_Tcpip_ICMP
- Win32_PerfRawData_Tcpip_IP
- Win32_PerfRawData_Tcpip_NBTConnection
- Win32_PerfRawData_Tcpip_网络接口
- Win32_PerfRawData_Tcpip_TCP
- Win32_PerfRawData_Tcpip_UDP
- Win32_PerfRawData_TermService_终端服务
- Win32_PerfRawData_TermService_TerminalServicesSession
- Win32_PerfRawData_W3SVC_WebService
- Win32_物理媒体
- Win32_物理内存
- Win32_PhysicalMemoryArray
- Win32_PhysicalMemoryLocation
- Win32_Ping状态
- Win32_PNPAllocatedResource
- Win32_PnP设备
- Win32_PnP实体
- Win32_PnPSigned驱动程序
- Win32_PnPSignedDriverCIM数据文件
- Win32_PointingDevice
- Win32_便携式电池
- Win32_端口连接器
- Win32_端口资源
- Win32_POTSModem
- Win32_POTSModemToSerialPort
- Win32_打印机
- Win32_打印机配置
- Win32_打印机控制器
- Win32_打印机驱动程序
- 打印机驱动程序动态链接库
- Win32_打印机设置
- Win32_打印机共享
- Win32_打印作业
- Win32_进程
- Win32_处理器
- Win32_产品
- Win32_产品检查
- Win32_产品资源
- Win32_产品软件功能
- Win32_ProgID规范
- Win32_程序组
- Win32_程序组内容
- Win32_属性
- Win32_协议绑定
- Win32_代理
- Win32_PublishComponentAction
- Win32_QuickFix工程
- Win32_配额设置
- Win32_制冷
- Win32_注册表
- Win32_RegistryAction
- Win32_删除文件操作
- Win32_RemoveIniAction
- Win32_ReserveCost
- Win32_ScheduledJob
- Win32_SCSI控制器
- Win32_SCSI控制器设备
- Win32_逻辑文件的安全设置
- Win32_SecuritySettingOfLogicalShare
- Win32_SelfRegModuleAction
- Win32_串行端口
- Win32_SerialPort配置
- Win32_SerialPort 设置
- Win32_服务器连接
- Win32_服务器会话
- Win32_服务
- Win32_服务控制
- Win32_服务规范
- Win32_ServiceSpecification服务
- Win32_会话连接
- Win32_会话进程
- Win32_共享
- Win32_共享目录
- Win32_快捷方式操作
- Win32_快捷方式文件
- Win32_快捷方式SAP
- Win32_SID
- Win32_软件元素
- Win32_SoftwareElementAction
- Win32_软件元素检查
- Win32_SoftwareElementCondition
- Win32_软件元素资源
- Win32_软件功能
- Win32_SoftwareFeatureAction
- Win32_软件功能检查
- Win32_SoftwareFeatureParent
- Win32_软件功能软件元素
- Win32_声音设备
- Win32_Startup命令
- Win32_子目录
- Win32_系统帐户
- Win32_系统BIOS
- Win32_SystemBoot配置
- Win32_系统桌面
- Win32_系统设备
- Win32_系统驱动程序
- Win32_SystemDriverPNP实体
- Win32_系统外壳
- Win32_SystemLoadOrderGroups
- Win32_SystemLogicalMemory配置
- Win32_SystemNetworkConnections
- Win32_System操作系统
- Win32_系统分区
- Win32_系统进程
- Win32_SystemProgramGroups
- Win32_系统资源
- Win32_系统服务
- Win32_SystemSlot
- Win32_System系统驱动程序
- Win32_SystemTimeZone
- Win32_系统用户
- Win32_磁带驱动器
- Win32_TCPIP打印机端口
- Win32_温度探测器
- Win32_终端
- Win32_终端服务
- Win32_TerminalService设置
- Win32_TerminalServiceToSetting
- Win32_Terminal终端设置
- Win32_线程
- Win32_TimeZone
- Win32_TSAccount
- Win32_TS客户端设置
- Win32_TS环境设置
- Win32_TS常规设置
- Win32_TSLogon 设置
- Win32_TSNetworkAdapterListSetting
- Win32_TSNetworkAdapter 设置
- Win32_TS权限设置
- Win32_TSRemoteControl 设置
- Win32_TSSession目录
- Win32_TSSessionDirectory设置
- Win32_TSSession 设置
- Win32_TypeLibraryAction
- Win32_不间断电源
- Win32_USB控制器
- Win32_USB控制器设备
- Win32_USBHub
- Win32_用户帐户
- Win32_用户桌面
- Win32_UserInDomain
- Win32_UTC时间
- Win32_视频控制器
- Win32_视频设置
- Win32_电压探测器
- Win32_VolumeQuota设置
- Win32_Windows产品激活
- Win32_WMIElement设置
- Win32_WMI设置
答案2
这些是 wmic 具有的 wmi 类别名(包括“别名”,即 ROOT\Cli 命名空间下的“Msft_CliAlias”),它们可能是您最常使用的 wmi 类(win32_userprofile 除外)。我在编辑器中对它们进行了排序。您始终可以在 powershell 中使用 get-wmiobject 或 get-ciminstance,但选项更多(“get-wmiobject win32_operatingsystem”)。
wmic alias get friendlyname,target
FriendlyName Target
Alias Select * from Msft_CliAlias
BIOS Select * from Win32_BIOS
BaseBoard Select * from Win32_BaseBoard
BootConfig Select * from Win32_BootConfiguration
CDROM Select * from Win32_CDROMDrive
CPU Select * from WIN32_PROCESSOR
CSProduct Select * from Win32_ComputerSystemProduct
ComputerSystem Select * from Win32_ComputerSystem
DCOMAPP Select * from WIN32_DCOMApplication
DESKTOP Select * from WIN32_DESKTOP
DMAChannel Select * from Win32_DMAChannel
DataFile Select * from CIM_DataFile
DesktopMonitor Select * from WIN32_DESKTOPMONITOR
DeviceMemoryAddress Select * from Win32_DeviceMemoryAddress
DiskDrive Select * from Win32_DiskDrive
DiskQuota Select * from Win32_DiskQuota
Environment Select * from Win32_Environment
FSDir Select * from Win32_Directory
Group Select * from Win32_Group
IDECONTROLLER Select * from Win32_IDEController
IRQ Select * from Win32_IRQResource
Job Select * from Win32_ScheduledJob
LOGON Select * from Win32_LogonSession
LoadOrder Select * from Win32_LoadOrderGroup
LogicalDisk Select * from Win32_LogicalDisk
MEMCACHE Select * from WIN32_CACHEMEMORY
MemPhysical Select * from Win32_PhysicalMemoryArray
MemoryChip Select * from Win32_PhysicalMemory
NIC Select * from Win32_NetworkAdapter
NICConfig Select * from Win32_NetworkAdapterConfiguration
NTDOMAIN Select * from Win32_NTDomain
NTEvent Select * from Win32_NTLogEvent
NTEventLog Select * from Win32_NTEventlogFile
NetClient Select * from WIN32_NetworkClient
NetLogin Select * from Win32_NetworkLoginProfile
NetProtocol Select * from Win32_NetworkProtocol
NetUse Select * from Win32_NetworkConnection
OS Select * from Win32_OperatingSystem
OnBoardDevice Select * from Win32_OnBoardDevice
PageFile Select * from Win32_PageFileUsage
PageFileSet Select * from Win32_PageFileSetting
Partition Select * from Win32_DiskPartition
Port Select * from Win32_PortResource
PortConnector Select * from Win32_PortConnector
PrintJob Select * from Win32_PrintJob
Printer Select * from Win32_Printer
PrinterConfig Select * from Win32_PrinterConfiguration
Process Select * from Win32_Process
Product Select * from Win32_Product
QFE Select * from Win32_QuickFixEngineering
QuotaSetting Select * from Win32_QuotaSetting
RDAccount Select * from Win32_TSAccount
RDNIC Select * from Win32_TSNetworkAdapterSetting
RDPermissions Select * from Win32_TSPermissionsSetting
RDToggle Select * from Win32_TerminalServiceSetting
RecoverOS Select * from Win32_OSRecoveryConfiguration
Registry Select * from Win32_Registry
SCSICONTROLLER Select * from Win32_SCSIController
Server Select * from Win32_PerfRawData_PerfNet_Server
Service Select * from Win32_Service
ShadowCopy Select * from Win32_ShadowCopy
ShadowStorage Select * from Win32_ShadowStorage
Share Select * from Win32_Share
SoftwareElement Select * from Win32_SoftwareElement
SoftwareFeature Select * from Win32_SoftwareFeature
SoundDev Select * from WIN32_SoundDevice
Startup Select * from Win32_StartupCommand
SysAccount Select * from Win32_SystemAccount
SysDriver Select * from Win32_SystemDriver
SystemEnclosure Select * from Win32_SystemEnclosure
SystemSlot Select * from Win32_SystemSlot
TapeDrive Select * from Win32_TapeDrive
Temperature Select * from Win32_TemperatureProbe
TimeZone Select * from Win32_TimeZone
UPS Select * from Win32_UninterruptiblePowerSupply
UserAccount Select * from Win32_UserAccount
Voltage Select * from Win32_VoltageProbe
Volume Select * from Win32_Volume
VolumeQuotaSetting Select * from Win32_VolumeQuotaSetting
VolumeUserQuota Select * from Win32_VolumeUserQuota
WMISet Select * from Win32_WMISetting
前三个的命名空间不同,而底部的命名空间已消失。对于影子命名空间,您需要成为管理员。我会使用 get-package 而不是 win32_product。
get-wmiobject -n Root\CIMV2\TerminalServices Win32_TerminalServiceSetting
get-wmiobject -n Root\CIMV2\TerminalServices Win32_TSAccount
get-wmiobject -n Root\CIMV2\TerminalServices Win32_TSPermissionsSetting
get-wmiobject Win32_UninterruptiblePowerSupply # Invalid class without a hardware ups?