Here is a script that I use to show WMI classes. I think you’ll find it useful. There is an example after the script:
############################################################################
# Show-WmiClass – 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. SHOW was added as a new “official
# verb to deal with just this case.
############################################################################
param(
$Name = “.”,
$NameSpace = “root\cimv2”,
[Switch]$Refresh=$false
)
# Getting a list of classes can be expensive and the list changes infrequently.
# This makes it a good candidate for caching.
$CacheDir = Join-path $env:Temp “WMIClasses”
$CacheFile = Join-Path $CacheDir ($Namespace.Replace(“\”,”-“) + “.csv”)
if (!(Test-Path $CacheDir))
{
$null = New-Item -Type Directory -Force $CacheDir
}
if (!(Test-Path $CacheFile) -Or $Refresh)
{
Get-WmiObject -List -Namespace:$Namespace |
Sort -Property Name |
Select -Property Name |
Export-csv -Path $CacheFile -Force
}
Import-csv -Path $CacheFile |
where {$_.Name -match $Name} |
Format-Wide -AutoSize
###### EOF ###########
Example
PS> show-wmiclass account
MSFT_NetBadAccount Win32_Account Win32_AccountSID
Win32_SystemAccount Win32_UserAccount
PS> show-wmiclass account -namespace root\cimv2\terminalservices
Win32_TSAccount
PS> show-wmiclass -namespace root\cimv2\terminalservices
__AbsoluteTimerInstruction __ACE
__AggregateEvent __ClassCreationEvent
__ClassDeletionEvent __ClassModificationEvent
__ClassOperationEvent __ClassProviderRegistration
__ConsumerFailureEvent __Event
__EventConsumer __EventConsumerProviderRegistration
__EventDroppedEvent __EventFilter
__EventGenerator __EventProviderRegistration
__EventQueueOverflowEvent __ExtendedStatus
__ExtrinsicEvent __FilterToConsumerBinding
__IndicationRelated __InstanceCreationEvent
__InstanceDeletionEvent __InstanceModificationEvent
__InstanceOperationEvent __InstanceProviderRegistration
__IntervalTimerInstruction __MethodInvocationEvent
__MethodProviderRegistration __NAMESPACE
__NamespaceCreationEvent __NamespaceDeletionEvent
__NamespaceModificationEvent __NamespaceOperationEvent
__NotifyStatus __NTLMUser9X
__ObjectProviderRegistration __PARAMETERS
__PropertyProviderRegistration __Provider
__ProviderRegistration __QOSFailureEvent
__SecurityDescriptor __SecurityRelatedClass
__SystemClass __SystemEvent
__SystemSecurity __thisNAMESPACE
__TimerEvent __TimerInstruction
__TimerNextFiring __Trustee
__Win32Provider CIM_ElementSetting
CIM_LogicalElement CIM_ManagedSystemElement
CIM_Setting Win32_Terminal
Win32_TerminalError Win32_TerminalServiceSetting
Win32_TerminalServiceSettingError Win32_TerminalServiceToSetting
Win32_TerminalSetting Win32_TerminalTerminalSetting
Win32_TSAccount Win32_TSClientSetting
Win32_TSEnvironmentSetting Win32_TSGeneralSetting
Win32_TSLogonSetting Win32_TSNetworkAdapterListSetting
Win32_TSNetworkAdapterSetting Win32_TSPermissionsSetting
Win32_TSRemoteControlSetting Win32_TSSessionDirectory
Win32_TSSessionDirectorySetting Win32_TSSessionSetting
PS>
Enjoy!
Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx
0 comments