Powershell Web Page Automation works on Internet, not Intranet

后端 未结 3 1022
甜味超标
甜味超标 2020-12-17 06:40

I\'m trying to do some simple automation with Powershell, pulling link URLs from one of our company\'s local intranet pages, and then doing some work with those URLs. Eventu

3条回答
  •  执念已碎
    2020-12-17 07:22

    Maybe the solution is here: http://blogs.msdn.com/b/ieinternals/archive/2011/08/03/internet-explorer-automation-protected-mode-lcie-default-integrity-level-medium.aspx

    It explained the different levels of tabs, in ie. You have to use the "medium tab" to navigate in local zone.

    Basically, the best way to keep your ie settings and use your script is to create a registry key, as explained in the link above.

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\InternetExplorer.ApplicationMedium]
    
    [HKEY_CLASSES_ROOT\InternetExplorer.ApplicationMedium\CLSID] 
    @="{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}"
    

    And in your script, use this new com object:

    $ie = new-object -Com InternetExplorer.ApplicationMedium
    ...
    

提交回复
热议问题