WMI Scripting - Hidden and Dangerous
notepad C:\TEMP\file.txt:myfile.vbs
Cscript C:\TEMP\file.txt:myfile.vbs
or
Wscript C:\TEMP\file.txt:myfile.vbs
______________
Contents of file.txt:myfile.vbs:
____
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root")
Set colNameSpaces = objSwbemServices.InstancesOf("__NAMESPACE")
For Each objNameSpace In colNameSpaces
Wscript.Echo objNameSpace.Name
Next
_______________
Notes: Set objService = objLocator.ConnectServer(".", "root\cimv2")')
Links: http://www.pcmag.com/article2/0,1759,1639276,00.asp
Cscript C:\TEMP\file.txt:myfile.vbs
or
Wscript C:\TEMP\file.txt:myfile.vbs
______________
Contents of file.txt:myfile.vbs:
____
strComputer = "."
Set objSWbemServices = GetObject("winmgmts:\\" & strComputer & "\root")
Set colNameSpaces = objSwbemServices.InstancesOf("__NAMESPACE")
For Each objNameSpace In colNameSpaces
Wscript.Echo objNameSpace.Name
Next
_______________
Notes: Set objService = objLocator.ConnectServer(".", "root\cimv2")')
Links: http://www.pcmag.com/article2/0,1759,1639276,00.asp