Get-CimInstance 参考 模块: CimCmdlets 从CIM 服务器获取类的 CIM 实例。 语法 PowerShell Get-CimInstance[-ClassName] <String> [-ComputerName <String[]>] [-KeyOnly] [-Namespace <String>] [-OperationTimeoutSec <UInt32>] [-QueryDialect <String>] [-Shallow] [-Filter <String>] [-Property <...
若要筛选掉元数据,请使用管道运算符 (|),将Get-CimInstance命令的结果发送到Select-Object -ExcludeProperty "CIM*"。 列出BIOS 信息 WMI Win32_BIOS 类返回有关本地计算机上系统 BIOS 的高度压缩的完整信息: PowerShell Get-CimInstance-ClassNameWin32_BIOS ...
Get-CimAssociatedInstance参考 模块: CimCmdlets 通过关联检索连接到特定 CIM 实例的 CIM 实例。语法PowerShell 复制 Get-CimAssociatedInstance [[-Association] <String>] [-ResultClassName <String>] [-InputObject] <CimInstance> [-Namespace <String>] [-OperationTimeoutSec <UInt32>] [-ResourceUri <...
Get-CimInstance -CimSession <CimSession[]> -ResourceUri <Uri> [-KeyOnly] [-Namespace <String>] [-OperationTimeoutSec <UInt32>] [-Shallow] [-Filter <String>] [-Property <String[]>] [<CommonParameters>]PowerShell Copia Get-CimInstance -CimSession <CimSession[]> [-ResourceUri <Uri>] [...
在Windows系统中,PowerShell有两个Cmdlet调用WMI或CIM,分别为Get-WmiObject和Get-CimInstance。这两个cmdlet可以结合"-class <WMI-Class>"以及一些其他参数进行使用。 注:WMI cmdlet 已弃用 ,建议使用 ”Get-CimInstance“替代 ”Get-WmiObject“ 下面来讲解这两个cmdlet的用法: ...
此示例使用Get-CimInstance在本地计算机上获取所有记事本进程的运行时间。 可以将Get-CimInstance与ComputerName参数配合使用,从远程计算机获取信息。 PowerShell $Processes=Get-CimInstance-ClassWin32_Process-Filter"name='notepad.exe'"$Processes|Format-TableProcessName, @{ Label ="Total Running Time"Expression =...
在PowerShell 3.0 中,你仍然可以使用功能强大的Get-WmiObject命令,但是它们会逐渐被CIM命令所替代。如果你已经在使用Get-WmiObject命令查询数据。那可以非常流畅地切换至Get-CimInstance,因为这类命令都比较类似。只不过Get-CimInstance执行的结果只是名副其实的Instance,没有包含任何方法信息。
Get-Partition-pvpvar |ForEach-Object{Write-Host"Before: $($pvar.PartitionNumber)"[pscustomobject]@{Filter="Index = $($_.DiskNumber)"} } |Get-CimInstanceWin32_DiskDrive |ForEach-Object{Write-Host"After: $($pvar.PartitionNumber)"}
# Set selected printer as standard$WPFSetStdPrinter.Add_Click({$StdPrinter= $$StdPrinterServer=$WPFAddedPrintersBox.SelectedItem.ComputerName$SetStdPrinter=$StdPrinter-Replace [RegEx]::Escape("\\$StdPrinterServer\")$printer= Get-CimInstance -Class Win32_Printer -Filter "ShareName='$SetStdPrinter...
Get-WmiObject命令用于检索 Windows 管理信息 (WMI) 对象,提供了丰富的系统管理功能。 2. 基本语法回顾 Get-WmiObject -Class ClassName -Class参数指定要检索的 WMI 类别的名称。 3. 进阶用法 3.1 使用-Filter参数 可以使用-Filter参数来过滤返回的结果,以满足特定条件。