Saturday, October 17, 2009

ListWmiNamespaces.ps1

# This is a example taken from the book "Microsoft Windows Powershell Step by step"


$wmi = Get-WmiObject -class __Namespace -namespace root
"Listing namespaces on " + $wmi[0].__server +
" please wait a second "
for ($i=0;$i -le $wmi.length;$i++)
{if ($i -lt $wmi.length)
{Write-Host -noNewLine "."
Start-Sleep -m 75}
else
{Write-Host "."}
}

$wmi | Format-List name
Write-Host -foregroundColor green "There are" $wmi.length `
"namespaces on this machine `n"

No comments:

Node.JS rest api Tutorials