Saturday 31 July 2010

Get-WmiClassDescription.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     This script gets and displays the description of a WMI Class.  
  4. .DESCRIPTION 
  5.     This script takes a WMI Class name as a parameter. The script 
  6.     then gets the class's description from the CIM repository and 
  7.     displays it. Based on a PowerShell.Com tip of the day! 
  8. .NOTES 
  9.     File Name  : Get-WmiClassDescription.ps1 
  10.     Author     : Thomas Lee - tfl@psp.co.uk 
  11.     Requires   : PowerShell Version 2.0 
  12. .LINK 
  13.     This script posted to: 
  14.         http://www.pshscripts.blogspot.com  
  15. .EXAMPLE 
  16.     PSH [C:\foo]: .\Get-WmiClassDescription.ps1 
  17.     Description for WMI Class Win32_ComputerSystem: 
  18.     The Win32_ComputerSystem class represents a computer system operating in a Win32 environment. 
  19. .EXAMPLE 
  20.     PSH [C:\foo]: . \Get-WmiClassDescription.ps1 win32_bios 
  21.     Description for WMI Class win32_bios: 
  22.     The Win32_BIOS class represents the attributes of the computer system's basic input/output services 
  23.     (BIOS) that are installed on the computer. 
  24. #> 
  25.  
  26. param
  27. [string] $WMIClassName = "Win32_ComputerSystem" 
  28.  
  29. # Get WMI class from class name 
  30. $class = [wmiclass]$wmiclassname 
  31.  
  32. # Now get then print the class description 
  33. # First use ammended qualifiers to get description 
  34. $class.psbase.Options.UseAmendedQualifiers = $true 
  35. "Description for WMI Class {0}:"  -f $WmiClassName 
  36. ($class.psbase.qualifiers["description"]).Value 

No comments: