Saturday, 26 March 2011

Query a reg key for bulk computer

On Error Resume Next
Set objShell = CreateObject("Wscript.Shell")
Set oFso = CreateObject("Scripting.FileSystemObject")
sDesktop = objShell.SpecialFolders("Desktop")
spath = sDesktop & "\Dclist.txt"
Set oT = oFso.OpenTextFile(spath,1)
Do Until oT.AtEndofStream
temp= oT.ReadLine()
strComputer = Trim(temp)

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002


Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "Hardware\DESCRIPTION\SYSTEM\BIOS\"
strValueName = "SystemManufacturer"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "OS Architecture for" & " " & strComputer & " " & "is: " & strValue
Loop

1 comment: