Jump to content

VBS Conversion problem


Recommended Posts

Hello,

I am trying to convert a TweakOmatic script for retrieving Internet explorer options.

Ultimatilly I want to be able to retrieve all internet explorer options so I can match up settings between different computers if a problem occurs with a Web App. I'll be sending all the output to a single file then writing a compare utility to dump out differences between computers.

Here is the VB Script that I am trying to convert from.

'   Allow ActiveX components to connect to a different server to obtain data (Zone 3)
On Error Resume Next
HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"
ValueName = "1406"
objReg.GetDWORDValue HKEY_CURRENT_USER, strKeyPath, ValueName, dwValue
If IsNull(strValue) Then
    Wscript.Echo "Allow ActiveX components to connect to a different server to obtain data (Zone 3):  The value is either Null or could not be found in the registry."
Else
    Wscript.Echo "Allow ActiveX components to connect to a different server to obtain data (Zone 3): ", dwValue
End If

Here is what I have converted so far. It always fails on line 9

;Allow ActiveX components to connect to a different server to obtain data (Zone 3)
Dim $dwValue, $strValue

$HKEY_CURRENT_USER = "&H80000001"
$strComputer = "."
$objReg = ObjGet("winmgmts:\\" & $strComputer & "\root\default:StdRegProv")
$strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3"
$ValueName = "1406"
$objReg.GetDWORDValue($HKEY_CURRENT_USER, $strKeyPath, $ValueName, $dwValue)
If $strValue == "" Then
    MsgBox(0, "", "Allow ActiveX components to connect to a different server to obtain data (Zone 3):  The value is either Null or could not be found in the registry.")
Else
    MsgBox(0, "", "Allow ActiveX components to connect to a different server to obtain data (Zone 3): ", $dwValue)
EndIf

Any help is greatly appreciated

Thanks,

Mike

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...