I've created a template script to read IP addresses from a list, then carry
out simple tasks such as read RAM, Host name, etc. which works absolutely
fine for whatever info I'm trying to gather and send to an output file.
Basically I'm just cut and pasting the main body of a script into my
template. I've now tried to adapt the script to read a registry key, but the
script returns no value for the registry key. The script is as follows -

On Error Resume Next

Const INPUT_FILE_NAME = "Addresses.txt"
Const FOR_READING = 1
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(INPUT_FILE_NAME, FOR_READING)

Do While objfile.AtEndofStream <> True
strComputers = objFile.Readline

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

Set cPingResults = objWMIService.ExecQuery("SELECT * FROM Win32_PingStatus
WHERE Address = '" + strComputers + "'")
For Each oPingResult In cPingResults
If oPingResult.StatusCode = 0 Then
WScript.Echo VbCrLf & strComputers & " responded to ping."

Set colCompSystems = objWMIService.ExecQuery("SELECT * FROM
Win32_ComputerSystem")
For Each objCompSystem In colCompSystems
WScript.Echo "Host Name: " & LCase(objCompSystem.Name)
Next

strKeyPath = "SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc."
strValueName = "PatternVer"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwvalue
Wscript.Echo "Current Pattern Version - " & dwvalue

Else
WScript.Echo VbCrLf & strComputers & " did not respond to ping *Target
Possibley Down.!*."
End If
Next

Loop
objFile.Close

IP address and Host name are displayed fine, and will also echo the "current
pattern version" line, but gives no value.
I created a simpler version of script to run on my local machine which goes -

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

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

strKeyPath = "SOFTWARE\TrendMicro\PC-cillinNTCorp\CurrentVersion\Misc."
strValueName = "PatternVer"
oReg.GetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwvalue
Wscript.Echo "Current Pattern Version - " & dwvalue

This returns the value that I'm looking for no problem, so I'm confident
that the code is ok.

I'm guessing it's something to do with syntax as opposed to code. Can
anyone help?