{"id":7321,"date":"2007-08-30T23:44:00","date_gmt":"2007-08-30T23:44:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/powershell\/2007\/08\/30\/show-wmiclass\/"},"modified":"2019-02-18T13:16:34","modified_gmt":"2019-02-18T20:16:34","slug":"show-wmiclass","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/show-wmiclass\/","title":{"rendered":"Show-WmiClass"},"content":{"rendered":"<p>Here is a script that I use to show WMI classes. I think you&#8217;ll find it useful. There is an example after the script: <\/p>\n<p><span>############################################################################<br \/># Show-WmiClass &#8211; Show WMI classes<br \/># Author: Microsoft<br \/># Version: 1.0<br \/># NOTE: Notice that this is uses the verb SHOW vs GET. That is because it<br \/># combines a Getter with a format. SHOW was added as a new &#8220;official<br \/># verb to deal with just this case.<br \/>############################################################################<br \/>param(<br \/>$Name = &#8220;.&#8221;,<br \/>$NameSpace = &#8220;root\\cimv2&#8221;,<br \/>[Switch]$Refresh=$false<br \/>)<\/p>\n<p># Getting a list of classes can be expensive and the list changes infrequently. <br \/># This makes it a good candidate for caching.<\/p>\n<p>$CacheDir = Join-path $env:Temp &#8220;WMIClasses&#8221;<br \/>$CacheFile = Join-Path $CacheDir ($Namespace.Replace(&#8220;\\&#8221;,&#8221;-&#8220;) + &#8220;.csv&#8221;)<br \/>if (!(Test-Path $CacheDir))<br \/>{<br \/>$null = New-Item -Type Directory -Force $CacheDir<br \/>}<\/p>\n<p>if (!(Test-Path $CacheFile) -Or $Refresh)<br \/>{<br \/>Get-WmiObject -List -Namespace:$Namespace |<br \/>Sort -Property Name |<br \/>Select -Property Name |<br \/>Export-csv -Path $CacheFile -Force<br \/>}<\/p>\n<p>Import-csv -Path $CacheFile | <br \/>where {$_.Name -match $Name} |<br \/>Format-Wide -AutoSize<br \/>###### EOF ###########<br \/><\/span><\/p>\n<p>Example <\/p>\n<p><span><br \/>PS&gt; show-wmiclass account<\/p>\n<p>MSFT_NetBadAccount Win32_Account Win32_AccountSID<br \/>Win32_SystemAccount Win32_UserAccount<\/p>\n<p>PS&gt; show-wmiclass account -namespace root\\cimv2\\terminalservices<\/p>\n<p>Win32_TSAccount<\/p>\n<p>PS&gt; show-wmiclass -namespace root\\cimv2\\terminalservices<\/p>\n<p>__AbsoluteTimerInstruction __ACE<br \/>__AggregateEvent __ClassCreationEvent<br \/>__ClassDeletionEvent __ClassModificationEvent<br \/>__ClassOperationEvent __ClassProviderRegistration<br \/>__ConsumerFailureEvent __Event<br \/>__EventConsumer __EventConsumerProviderRegistration<br \/>__EventDroppedEvent __EventFilter<br \/>__EventGenerator __EventProviderRegistration<br \/>__EventQueueOverflowEvent __ExtendedStatus<br \/>__ExtrinsicEvent __FilterToConsumerBinding<br \/>__IndicationRelated __InstanceCreationEvent<br \/>__InstanceDeletionEvent __InstanceModificationEvent<br \/>__InstanceOperationEvent __InstanceProviderRegistration<br \/>__IntervalTimerInstruction __MethodInvocationEvent<br \/>__MethodProviderRegistration __NAMESPACE<br \/>__NamespaceCreationEvent __NamespaceDeletionEvent<br \/>__NamespaceModificationEvent __NamespaceOperationEvent<br \/>__NotifyStatus __NTLMUser9X<br \/>__ObjectProviderRegistration __PARAMETERS<br \/>__PropertyProviderRegistration __Provider<br \/>__ProviderRegistration __QOSFailureEvent<br \/>__SecurityDescriptor __SecurityRelatedClass<br \/>__SystemClass __SystemEvent<br \/>__SystemSecurity __thisNAMESPACE<br \/>__TimerEvent __TimerInstruction<br \/>__TimerNextFiring __Trustee<br \/>__Win32Provider CIM_ElementSetting<br \/>CIM_LogicalElement CIM_ManagedSystemElement<br \/>CIM_Setting Win32_Terminal<br \/>Win32_TerminalError Win32_TerminalServiceSetting<br \/>Win32_TerminalServiceSettingError Win32_TerminalServiceToSetting<br \/>Win32_TerminalSetting Win32_TerminalTerminalSetting<br \/>Win32_TSAccount Win32_TSClientSetting<br \/>Win32_TSEnvironmentSetting Win32_TSGeneralSetting<br \/>Win32_TSLogonSetting Win32_TSNetworkAdapterListSetting<br \/>Win32_TSNetworkAdapterSetting Win32_TSPermissionsSetting<br \/>Win32_TSRemoteControlSetting Win32_TSSessionDirectory<br \/>Win32_TSSessionDirectorySetting Win32_TSSessionSetting<\/p>\n<p>PS&gt;<br \/><\/span><\/p>\n<p><span>Enjoy! <\/span><\/p>\n<p><span>Jeffrey Snover [MSFT]<br \/>Windows Management Partner Architect<br \/>Visit the Windows PowerShell Team blog at: <a href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/a><br \/>Visit the Windows PowerShell ScriptCenter at: <a href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/a> <\/span><\/p>\n<p><span><\/span>&nbsp;<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/MSDNBlogsFS\/prod.evol.blogs.msdn.com\/CommunityServer.Components.PostAttachments\/00\/04\/65\/97\/61\/Show-wmiclass.ps1\">Show-wmiclass.ps1<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a script that I use to show WMI classes. I think you&#8217;ll find it useful. There is an example after the script: ############################################################################# Show-WmiClass &#8211; Show WMI classes# Author: Microsoft# Version: 1.0# NOTE: Notice that this is uses the verb SHOW vs GET. That is because it# combines a Getter with a format. [&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":[],"class_list":["post-7321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>Here is a script that I use to show WMI classes. I think you&#8217;ll find it useful. There is an example after the script: ############################################################################# Show-WmiClass &#8211; Show WMI classes# Author: Microsoft# Version: 1.0# NOTE: Notice that this is uses the verb SHOW vs GET. That is because it# combines a Getter with a format. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/7321","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=7321"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/7321\/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=7321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=7321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=7321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}