主頁 > 知識庫 > Powershell中使用WMI工具例子

Powershell中使用WMI工具例子

熱門標(biāo)簽:真人和電話機器人對話 安徽400電話辦理 湖州電銷防封卡 什么渠道可以找外呼系統(tǒng)客戶 雷霆電話機器人電話 電話智能外呼系統(tǒng)誠信合作 信陽話務(wù)外呼系統(tǒng)怎么收費 金融電銷公司怎么辦理外呼系統(tǒng) 使用電話機器人電銷是否違法

支持所有版本

WMI是一個強大的技術(shù):只需要簡單的指定一個WMI類名就能返回它類的所有實例:

復(fù)制代碼 代碼如下:

PS> Get-WmiObject -Class Win32_BIOS

SMBIOSBIOSVersion : 76CN27WW
Manufacturer      : LENOVO
Name              : 76CN27WW
SerialNumber      : 1006250300406
Version           : LENOVO - 1

你如何知道它有哪些類呢?這里有一款查找工具:

復(fù)制代碼 代碼如下:

function Find-WMIClass
{
   param
   (
      [Parameter(Mandatory=$true)]
      $SearchTerm = 'Resolution'
   )
  
   Get-WmiObject -Class * -List |
   Where-Object { $_.Properties.Count -ge 3 } |
   Where-Object { $_.Name -notlike 'Win32_Perf*'  } |
   Where-Object {
      $ListOfNames = $_.Properties | Select-Object -ExpandProperty Name
      ($ListOfNames -like "*$SearchTerm*") -ne $null
   } |
   Sort-Object -Property Name 
}

設(shè)置搜索條件后,代碼將搜索出包含指定屬性名的類(還可以通過通配符擴大搜索范圍)

下面將找出所有包含“resolution”結(jié)尾的WMI類:

復(fù)制代碼 代碼如下:

PS> Find-WMIClass -SearchTerm *resolution


   NameSpace: ROOT\cimv2

Name                                Methods              Properties              
----                                -------              ----------              
CIM_CacheMemory                     {SetPowerState, R... {Access, AdditionalErr...
CIM_CurrentSensor                   {SetPowerState, R... {Accuracy, Availabilit...
CIM_FlatPanel                       {SetPowerState, R... {Availability, Caption...
CIM_Memory                          {SetPowerState, R... {Access, AdditionalErr...
CIM_MonitorResolution               {}                   {Caption, Description,...
CIM_NonVolatileStorage              {SetPowerState, R... {Access, AdditionalErr...
CIM_NumericSensor                   {SetPowerState, R... {Accuracy, Availabilit...
CIM_PCVideoController               {SetPowerState, R... {AcceleratorCapabiliti...
CIM_PointingDevice                  {SetPowerState, R... {Availability, Caption...
CIM_Printer                         {SetPowerState, R... {Availability, Availab...
CIM_Tachometer                      {SetPowerState, R... {Accuracy, Availabilit...
CIM_TemperatureSensor               {SetPowerState, R... {Accuracy, Availabilit...
CIM_VideoController                 {SetPowerState, R... {AcceleratorCapabiliti...
CIM_VideoControllerResolution       {}                   {Caption, Description,...
CIM_VolatileStorage                 {SetPowerState, R... {Access, AdditionalErr...
CIM_VoltageSensor                   {SetPowerState, R... {Accuracy, Availabilit...
Win32_CacheMemory                   {SetPowerState, R... {Access, AdditionalErr...
Win32_CurrentProbe                  {SetPowerState, R... {Accuracy, Availabilit...
Win32_DisplayControllerConfigura... {}                   {BitsPerPixel, Caption...
Win32_MemoryArray                   {SetPowerState, R... {Access, AdditionalErr...
Win32_MemoryDevice                  {SetPowerState, R... {Access, AdditionalErr...
Win32_NetworkAdapterConfiguration   {EnableDHCP, Rene... {ArpAlwaysSourceRoute,...
Win32_PointingDevice                {SetPowerState, R... {Availability, Caption...
Win32_Printer                       {SetPowerState, R... {Attributes, Availabil...
Win32_PrinterConfiguration          {}                   {BitsPerPel, Caption, ...
Win32_SMBIOSMemory                  {SetPowerState, R... {Access, AdditionalErr...
Win32_TemperatureProbe              {SetPowerState, R... {Accuracy, Availabilit...
Win32_VideoConfiguration            {}                   {ActualColorResolution...
Win32_VideoController               {SetPowerState, R... {AcceleratorCapabiliti...
Win32_VoltageProbe                  {SetPowerState, R... {Accuracy, Availabilit...

接著,就可以使用類名查看它的有效數(shù)據(jù)啦:

復(fù)制代碼 代碼如下:

PS> Get-WmiObject -Class CIM_CacheMemory | Select-Object -Property *

標(biāo)簽:濟南 山南 六盤水 鶴崗 湛江 運城 德州 岳陽

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Powershell中使用WMI工具例子》,本文關(guān)鍵詞  Powershell,中,使用,WMI,工具,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Powershell中使用WMI工具例子》相關(guān)的同類信息!
  • 本頁收集關(guān)于Powershell中使用WMI工具例子的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章