Script works in .vbs file but not in codebehind .vb

  • Thread starter Thread starter CodeNemesis
  • Start date Start date
C

CodeNemesis

Guest
Quick question. When I run this as a .vbs from the command prompt, it works, but when I try to translate the script to put in a codebehind file .vb I get the following response from Visual Studio 2010:

Declares oreg as GetObject
Dim oReg As Object =
GetObject( _
"winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

Checks Trusted Sites Zone Privacy and Security Settings
objLog.WriteLine("----------------------------")
objLog.WriteLine("ZONE 2 - Trusted Sites Zone-")
objLog.WriteLine("----------------------------")
For Each item In reglist
oReg.GetDWORDValue( _
HKEY_CURRENT_USER, zone2, item, dwValue)
objLog.WriteLine(item & " RegistryValue: " & dwValue)
Next
objLog.WriteLine("")

The error Im getting is that dwValue is not declared. Im encasing the second declaration in a sub, which I need to. Otherwise, when running .vbs there is no problem with getting that variable.

Keep in mind that Im declaring these now in a partial class .vb file as codebehind. Could that have anything to do with it?

Continue reading...
 
Back
Top