by Karthikeyan (187 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Unknown Difficulty
Originally Published: Tue 11th May 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Get all the root name spaces of your machine using WMI script
Computer = "."
Const ForAppending = 2
Set OutFile = CreateObject("WScript.Shell")
Set FileSystem = CreateObject("Scripting.FileSystemObject")
Set TextFile = FileSystem.OpenTextFile ("c:\NameSpaces.txt", ForAppending, True)
TextFile.WriteLine "Name Spaces of this Machine"
TextFile.WriteLine "---------------------------"
TextFile.WriteLine
Call NameSpaces("root")
TextFile.Close
OutFile.Run "notepad.exe c:\NameSpaces.txt",1,True
Sub NameSpaces(NameSpace)
TextFile.WriteLine NameSpace
Set WMIService = GetObject("winmgmts:\\" & Computer & "\" & NameSpace)
Set OupNameSpaces = WMIService.InstancesOf("__NAMESPACE")
For Each ItemNameSpace In OupNameSpaces
Call NameSpaces(NameSpace & "\" & ItemNameSpace.Name)
Next
End Sub