SELECT …

isn’t a very good tool to use from Windows PowerShell. You’ll get a lot further using

(Windows PowerShell only) or

wmic qfe list

(PS v3.0+ including PS Core).

wmic qfe list | SELECT InstalledOn

The pain of switching between the two is knowing what

alias maps to which WMI 选择返回空列表

解决方案:

wmic.exe它返回已安装的Windows更新。但我只想列出某些属性,所以我写了这个(有多个属性)。Get-WmiObject但它返回的是一个空列表。我到底做错了什么?Get-CimInstance

wmic我有这个命令:wmic qfe list 它返回已安装的windows更新,但我只想让某些属性被列出,所以我写了这个(有多个属性):但它返回一个空列表。但我只想列出某些属性,所以我写了这个(有多个属性):wmic qfe list CIM class。幸运的是,你可以运行一个命令来告诉你地图是什么。wmic alias list brief 返回这个。

FriendlyName         PWhere                                          Target
------------         ------                                          ------
NICConfig            Where Index=#                                   Select * from Win32_NetworkAdapterConfiguration
SysDriver            where Name='#'                                  Select * from Win32_SystemDriver
TapeDrive                                                            Select * from Win32_TapeDrive
NTEventLog           WHERE LogfileName='#'                           Select * from Win32_NTEventlogFile
UserAccount                                                          Select * from Win32_UserAccount
Job                  WHERE jobid=#                                   Select * from Win32_ScheduledJob
SoftwareElement                                                      Select * from Win32_SoftwareElement
Volume               Where DeviceID = '#'                            Select * from Win32_Volume
NetProtocol                                                          Select * from Win32_NetworkProtocol
QuotaSetting                                                         Select * from Win32_QuotaSetting
Group                                                                Select * from Win32_Group
BIOS                                                                 Select * from Win32_BIOS
UPS                                                                  Select * from Win32_UninterruptiblePowerSupply
Server                                                               Select * from Win32_PerfRawData_PerfNet_Server
VolumeUserQuota      Where Account = # and Volume = #                Select * from Win32_VolumeUserQuota
ShadowCopy           Where ID = '#'                                  Select * from Win32_ShadowCopy
RDAccount            Where AccountName = '#' and TerminalName = '#'  Select * from Win32_TSAccount
Port                                                                 Select * from Win32_PortResource
PrinterConfig        WHERE Name='#'                                  Select * from Win32_PrinterConfiguration
Environment                                                          Select * from Win32_Environment
Registry                                                             Select * from Win32_Registry
BootConfig                                                           Select * from Win32_BootConfiguration
DesktopMonitor       WHERE DEVICEID='#'                              Select * from WIN32_DESKTOPMONITOR
QFE                                                                  Select * from Win32_QuickFixEngineering
PrintJob             WHERE JobId=#                                   Select * from Win32_PrintJob
DiskDrive            WHERE Index=#                                   Select * from Win32_DiskDrive
VolumeQuotaSetting   Where Element = # and Setting = #               Select * from Win32_VolumeQuotaSetting
RDToggle             Where ServerName = '#'                          Select * from Win32_TerminalServiceSetting
Startup              where Caption='#'                               Select * from Win32_StartupCommand
OS                                                                   Select * from Win32_OperatingSystem
IRQ                  WHERE IRQNumber=#                               Select * from Win32_IRQResource
Share                WHERE Name='#'                                  Select * from Win32_Share
ComputerSystem                                                       Select * from Win32_ComputerSystem
ShadowStorage        Where DiffVolume = # and Volume = #             Select * from Win32_ShadowStorage
Service              WHERE Name='#'                                  Select * from Win32_Service
RDNIC                Where TerminalName = '#'                        Select * from Win32_TSNetworkAdapterSetting
LOGON                                                                Select * from Win32_LogonSession
NTDOMAIN             WHERE DomainName='#'                            Select * from Win32_NTDomain
RDPermissions        Where TerminalName = '#'                        Select * from Win32_TSPermissionsSetting
PortConnector        WHERE ExternalReferenceDesignator='#'           Select * from Win32_PortConnector
IDECONTROLLER                                                        Select * from Win32_IDEController
MEMCACHE             WHERE DeviceID='#'                              Select * from WIN32_CACHEMEMORY
TimeZone                                                             Select * from Win32_TimeZone
LogicalDisk          WHERE Name='#'                                  Select * from Win32_LogicalDisk
MemoryChip           Where Tag = '#'                                 Select * from Win32_PhysicalMemory
SoundDev             WHERE Name='#'                                  Select * from WIN32_SoundDevice
Product              WHERE Name='#'                                  Select * from Win32_Product
DMAChannel           Where DMAChannel=#                              Select * from Win32_DMAChannel
DeviceMemoryAddress                                                  Select * from Win32_DeviceMemoryAddress
FSDir                WHERE Name='#'                                  Select * from Win32_Directory
NIC                  WHERE DeviceID=#                                Select * from Win32_NetworkAdapter
Temperature                                                          Select * from Win32_TemperatureProbe
DESKTOP              WHERE Name='#'                                  Select * from WIN32_DESKTOP
DiskQuota                                                            Select * from Win32_DiskQuota
DataFile             Where Name = '#'                                Select * from CIM_DataFile
DCOMAPP              WHERE Name='#'                                  Select * from WIN32_DCOMApplication
Process              WHERE ProcessId='#'                             Select * from Win32_Process
BaseBoard                                                            Select * from Win32_BaseBoard
LoadOrder                                                            Select * from Win32_LoadOrderGroup
PageFileSet                                                          Select * from Win32_PageFileSetting
Partition            WHERE Index=#                                   Select * from Win32_DiskPartition
SysAccount           WHERE Name='#'                                  Select * from Win32_SystemAccount
PageFile                                                             Select * from Win32_PageFileUsage
SystemSlot                                                           Select * from Win32_SystemSlot
SystemEnclosure                                                      Select * from Win32_SystemEnclosure
WMISet                                                               Select * from Win32_WMISetting
Voltage                                                              Select * from Win32_VoltageProbe
RecoverOS                                                            Select * from Win32_OSRecoveryConfiguration
CDROM                Where Drive='#'                                 Select * from Win32_CDROMDrive
NTEvent              WHERE EventType=#                               Select * from Win32_NTLogEvent
Printer              WHERE Name='#'                                  Select * from Win32_Printer
OnBoardDevice                                                        Select * from Win32_OnBoardDevice
SoftwareFeature                                                      Select * from Win32_SoftwareFeature
MemPhysical                                                          Select * from Win32_PhysicalMemoryArray
NetUse               WHERE LocalName='#'                             Select * from Win32_NetworkConnection
CPU                  Where DeviceID='#'                              Select * from WIN32_PROCESSOR
Alias                Where FriendlyName = '#'                        Select * from Msft_CliAlias
NetLogin             WHERE Name='#'                                  Select * from Win32_NetworkLoginProfile
NetClient            WHERE Name='#'                                  Select * from WIN32_NetworkClient
SCSICONTROLLER                                                       Select * from Win32_SCSIController
CSProduct                                                            Select * from Win32_ComputerSystemProduct

这里我们可以看到 QFE 地图到 Win32_QuickFixEngineering.

所以,你会想试试这些。

Get-WmiObject -Class Win32_QuickFixEngineering | Select-Object -Property InstalledOn

或者:

Get-CimInstance -Class Win32_QuickFixEngineering | Select-Object -Property InstalledOn

你也可以用 Get-HotFix 正如评论中提到的,但这可能与输出不100%匹配。我不是100%确定 Get-HotFix 命令的工作原理,正是如此。它可能比WMICIM类更全面。

给TA打赏
共{{data.count}}人
人已打赏
解决方案

匹配特定单词之间的字符串,并在其后面加上成对的括号,支持单层嵌套,但有一个例外。

2022-5-13 13:00:11

解决方案

如何从API(URL)在flutter中分享图像?

2022-5-13 13:00:13

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索