Jump to content

ObjGet not getting object with winmgmts (WMI proxy script)


Recommended Posts

Hi, I'm trying to get WMI proxy behavior working for a script. Got this code from a previous thread:

$objWMIService2 = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2\Applications\MicrosoftIE")
$colIESettings3 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_LANSettings")

Getting the following error on execution:

Variable must be of type "Object".:

$colIESettings3 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_LANSettings")

$colIESettings3 = $objWMIService2^ ERROR

In an earlier thread it was recommended I get the production version of AutoIt (not beta)--I've confirmed I'm on v3.3.8.1, I think that should be the most recent stable version right?

Any idea how I can either get this object or any alternative way to clear the IE proxy so I can set another proxy mid-script execution?

Link to post
Share on other sites

Are you sure that rootCIMV2ApplicationsMicrosoftIE exists or you have classes within rootCIMV2ApplicationsMicrosoftIE?

You can verify it with wbemtest.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites

Yes, it seems that the namespace is not available.

Better overview of all namespaces can be seen with Scriptomatic.

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites

Thanks for checking it out. So what should I do in order to change proxy midway through a script execute?

For example with the below method of changing proxy handling:

$HKEY_CURRENT_USER = 0x80000001

$strComputer = "."
$objRegistry = ObjGet("winmgmts:" & $strComputer & "rootdefault:StdRegProv")

$strKeyPath = "SOFTWAREMicrosoftWindowsCurrentVersionInternet Settings"

$strValueName = "ProxyEnable"
$dwValue = 1
$objRegistry.SetDWORDValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $dwValue)

$strValueName = "ProxyServer"
$strValue = "111.111.111.111:8800" ; The proxy IPs I'm using are working fine, they just can't be changed mid-execution
$objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue)

$strValueName = "ProxyOverride"
$strValue = "<local>"
$objRegistry.SetStringValue ($HKEY_CURRENT_USER, $strKeyPath, $strValueName, $strValue)

How can I then clear the proxy IP (111.111.111.111:8800) during script execution and then use a different one?

Edited by crushr
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...