I got sick of fiddling around with WMI namespace so I produced a really simple script to cope with this. I call it Get-WmiNamespace:
PS> cat .\Get-WMIChildNameSpace.ps1
param ($Namespace=”root\cimv2″, $Computer=”.”, $Column=4)
Get-WmiObject -Computer:$Computer -NameSpace:$NameSpace __NameSpace |Format-Wid
e -Column:$Column
PS>
PS> .\Get-WmiChildNamespace.ps1
Security SMS ms_409 TerminalServices
Applications
PS> .\Get-WmiChildNamespace.ps1 -namespace root -column 5
subscription DEFAULT MicrosoftDfs CIMV2 Cli
nap MicrosoftIISv2 SECURITY RSOP WebAdministr…
WMI directory Policy ServiceModel SecurityCenter
MSAPPS12 Microsoft aspnet vm
PS> .\Get-WmiChildNamespace.ps1 -namespace root\vm -column 5
Virtualserver
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