{"id":7231,"date":"2007-09-24T18:50:00","date_gmt":"2007-09-24T18:50:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2007\/09\/24\/get-wmihelp-amp-search-wmihelp\/"},"modified":"2019-02-18T13:16:31","modified_gmt":"2019-02-18T20:16:31","slug":"get-wmihelp-amp-search-wmihelp","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/get-wmihelp-amp-search-wmihelp\/","title":{"rendered":"Get-WmiHelp &#038;amp; Search-WmiHelp"},"content":{"rendered":"<p><span>Both PowerShell and Windows Management Instrumentation (WMI)&nbsp;are&nbsp;pretty incredible technologies that can do a lot of amazing things, but&nbsp;we&#8217;re all human, and keeping&nbsp;an encyclopedic mental reference of all of these&nbsp;amazing things&nbsp;would&nbsp;give Good Will Hunting a headache.&nbsp; For years, when I used WMI I almost always had a browser open to MSDN to help me figure out and remember the little details of a class in WMI, and, for all of the desktop clutter, it never bothered me&#8230; until I started using Powershell and had Get-Help and Get-Command.<\/span><\/p>\n<p><span>These two cmdlets rocked my world.&nbsp; Get-Command could tell me all of the commands in a system, and the properties they accepted.&nbsp; Get-Help told me what the cmdlet did, and how to use it.&nbsp; All of a sudden I had the kinds of information I was always looking up online right at my fingertips&#8230; but not for WMI.<\/span><\/p>\n<p><span>Luckily, it turns out that WMI actually has a way to provide help information.&nbsp; If you run Get-WmiObject, you can see what I mean:<\/span><\/p>\n<p><span>&nbsp;Get-WmiObject __Namespace | Format-Table Name<\/span><\/p>\n<p><span>This lists the namespaces underneath root\\cimv2.&nbsp; You should have at least one namespace named something like ms_### .&nbsp; This namespace contains localized class help for the WMI classes in the parent namespace.<\/span><\/p>\n<p><span>This means that&nbsp;no matter where in the world you are, you can get help from WMI in your language without connecting to the internet.<\/span><\/p>\n<p><span>I wrote a few functions to make this feature of WMI a lot easier to access.&nbsp;<\/span><\/p>\n<p><span>Get-WmiHelp: Gets you a dictionary with the help for a specific WMI class<br \/>Search-WmiHelp: Searches through the namespace for classes that match certain filters<\/span><\/p>\n<p><span>Here are some examples:<\/span><\/p>\n<p><span>Get-WmiHelp Win32_Process<\/span><\/p>\n<p><span>Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value<br \/>&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8211;<br \/>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The Win32_Process class represents a sequence&#8230;<br \/>Properties&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {QuotaPeakPagedPoolUsage, CSCreationClassName&#8230;<br \/>Methods&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Terminate, AttachDebugger, Create, GetOwner&#8230;}<\/span><\/p>\n<p><span>(Get-WmiHelp Win32_Bios).Description<\/span><\/p>\n<p><span>The Win32_BIOS class represents the attributes of the computer system&#8217;s basic input\/output services (BIOS) that are installed on the computer.<\/span><\/p>\n<p><span>(Get-WmiHelp Win32_Process).Methods.Create<\/span><\/p>\n<p><span>The Create method creates a new process.<br \/>The method returns an integer value that can be interpretted as follows:<br \/>0 &#8211; Successful completion.<br \/>2 &#8211; The user does not have access to the requested information.<br \/>3 &#8211; The user does not have sufficient privilge.<br \/>8 &#8211; Unknown failure.<br \/>9 &#8211; The path specified does not exist.<br \/>21 &#8211; The specified parameter is invalid.<br \/>Other &#8211; For integer values other than those listed above, refer to Win32 error code documentation.<\/span><\/p>\n<p><span>(Get-WmiHelp Win32_Volume).Properties.StatusInfo<\/span><\/p>\n<p><span>StatusInfo is a string indicating whether the logical device is in an enabled (value = 3), disabled (value = 4) or some other (1) or unknown (2) state. If thi<br \/>s property does not apply to the logical device, the value, 5 (&#8220;Not Applicable&#8221;), should be used.&nbsp;<\/span><\/p>\n<p><span>Search-WmiHelp {$_ -like &#8220;*Disk*&#8221;} # Finds all classes whose description contains &#8220;Disk&#8221;<\/span><\/p>\n<p><span>Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value<br \/>&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;<br \/>Win32_OperatingSystemAutoch&#8230; {Description, Properties, Methods}<br \/>Win32_Volume&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Description, Properties, Methods}<br \/>&#8230;.<\/span><\/p>\n<p><span>Search-WmiHelp -Method {$_.Key -like &#8220;*Create*} # Finds all classes that contain a method named create<\/span><\/p>\n<p><span>Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value<br \/>&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8212;&#8211;<br \/>Win32_Service&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Description, Properties, Methods}<br \/>Win32_BaseService&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Description, Properties, Methods}<br \/>Win32_TerminalService&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Description, Properties, Methods}<br \/>Win32_Share&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Description, Properties, Methods}<\/span><\/p>\n<p><span>&#8230;<\/span><\/p>\n<p><span>Search-WmiHelp -Property {$_.Value -like &#8220;*Quota*} # Finds all classes that contain a property whose description contains &#8220;Quota&#8221;<\/span><\/p>\n<p><span>Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value<br \/>&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;<br \/>Win32_QuotaSetting&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Description, Properties, Methods}<br \/>Win32_LogicalDisk&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Description, Properties, Methods}<br \/>Win32_VolumeQuota&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Description, Properties, Methods}<br \/>Win32_VolumeUserQuota&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{Description, Properties, Methods}<br \/>Win32_Process&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Description, Properties, Methods}<br \/>Win32_MappedLogicalDisk&nbsp;&nbsp;&nbsp;{Description, Properties, Methods}<br \/>Win32_Volume&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Description, Properties, Methods}<br \/>Win32_VolumeQuotaSetting&nbsp;{Description, Properties, Methods}<br \/>Win32_DiskQuota&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Description, Properties, Methods}&nbsp;<\/span><\/p>\n<p><span>&nbsp;Hope this helps,<\/span><\/p>\n<p><span>&nbsp;James Brundage [MSFT]<\/span><\/p>\n<p><span>&#8212;<\/span><\/p>\n<p><span>Update: I have added a -Culture option to Get-WmiHelp and Search-WmiHelp.&nbsp; If&nbsp;Search-WmiHelp is giving you&nbsp;an&nbsp;&#8220;Invalid Namespace&#8221; error, then run:<\/span><\/p>\n<p><span>&nbsp;Get-WmiObject&nbsp;&#8220;__Namespace&#8221;&nbsp;| Format-List Name<\/span><span>&nbsp;and try passing the value of any ms_### namespace to Get-WmiHelp\/Search-WmiHelp<\/span><\/p>\n<p><span>&nbsp;<\/span><span>e.g. Get-WmiHelp Win32_Process -culture 0xc0a:<\/span><\/p>\n<p><span>Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value<br \/>&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;<br \/>Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; La clase Win32_Process representa una secuenc&#8230;<br \/>Properties&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {QuotaPeakPagedPoolUsage, CSCreationClassName&#8230;<br \/>Methods&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {Terminate, AttachDebugger, Create, GetOwner&#8230;}&nbsp;<\/span><\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/05\/10\/81\/89\/Add-WmiHelpFunctions.ps1\">Add-WmiHelpFunctions.ps1<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Both PowerShell and Windows Management Instrumentation (WMI)&nbsp;are&nbsp;pretty incredible technologies that can do a lot of amazing things, but&nbsp;we&#8217;re all human, and keeping&nbsp;an encyclopedic mental reference of all of these&nbsp;amazing things&nbsp;would&nbsp;give Good Will Hunting a headache.&nbsp; For years, when I used WMI I almost always had a browser open to MSDN to help me figure out [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-7231","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell","tag-wmi"],"acf":[],"blog_post_summary":"<p>Both PowerShell and Windows Management Instrumentation (WMI)&nbsp;are&nbsp;pretty incredible technologies that can do a lot of amazing things, but&nbsp;we&#8217;re all human, and keeping&nbsp;an encyclopedic mental reference of all of these&nbsp;amazing things&nbsp;would&nbsp;give Good Will Hunting a headache.&nbsp; For years, when I used WMI I almost always had a browser open to MSDN to help me figure out [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/7231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=7231"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/7231\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=7231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=7231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=7231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}