Get-WmiChildNameSpace

Get-WmiChildNameSpace

  • Comments 4

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

Leave a Comment
  • Please add 5 and 8 and type the answer here:
  • Post
  • Would it not make more sense to handle this using Get-ChildItem (something like gci | ? { $_.PSIsContainer })?  I believe there is a community extension that make WMI appear as a PowerShell provider.

  • If you know of a WMI namespace provider - please share it.  This would definately be the way to go.

    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

  • I tried to find what I remembered, and it looks like I confused an hypothetic WMI provider with the GAC namespace provider in PowerShellCX, since both ideas were discussed in the newsgroups at about the same time.  Sorry for the mistake.

  • hmmm... WMI -- I smell another provider coming on... ;-)

Page 1 of 1 (4 items)