国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PowerShell > 正文

Powershell中使用WMI工具例子

2020-03-26 19:12:50
字體:
來源:轉載
供稿:網友

支持所有版本

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

 

復制代碼 代碼如下:

PS> Get-WmiObject -Class Win32_BIOS

 

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

 

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

 

復制代碼 代碼如下:

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 
}

 

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

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

 

復制代碼 代碼如下:

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...

 

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

 

復制代碼 代碼如下:

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

 

 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 科尔| 略阳县| 大丰市| 涪陵区| 商南县| 资源县| 铁岭市| 隆化县| 汉寿县| 皋兰县| 白银市| 永州市| 开阳县| 璧山县| 漯河市| 宜兰市| 墨脱县| 通渭县| 永城市| 右玉县| 芒康县| 定襄县| 三亚市| 洪洞县| 溧水县| 芒康县| 漾濞| 新密市| 保靖县| 什邡市| 惠来县| 桂阳县| 无锡市| 吉木萨尔县| 墨江| 郓城县| 南充市| 台江县| 平山县| 虹口区| 华容县|