tbroecker
Goto Top

Powershell Internetexplorer steuern

Moin,

ich möchte mit der Windows Powershell eine Webseite aufrufen und mich an dieser automatisch anmelden.

Mit folgenden Befehlen kann ich eine Webseite aufrufen.
$ie = New-Object -com internetexplorer.application
$ie.Visible =$true
$ie.Navigate("https://www.google.de")  
Soweit funktioniert es auf meinem PC und auf anderen.
Wenn ich nun bei mir $ie.Document ausgeben bekomme ich sämtliche Eigenschaften der Webseite.
Script                            : System.__ComObject
all                               : System.__ComObject
body                              : System.__ComObject
activeElement                     : System.__ComObject
images                            : System.__ComObject
applets                           : System.__ComObject
links                             : System.__ComObject
forms                             : System.__ComObject
anchors                           : System.__ComObject
title                             : Google
scripts                           : System.__ComObject
designMode                        : Inherit
selection                         : System.__ComObject
readyState                        : complete
frames                            : System.__ComObject
embeds                            : System.__ComObject
plugins                           : System.__ComObject
alinkColor                        : #dd4b39
bgColor                           : #ffffff
fgColor                           : #222222
linkColor                         : #01020c
vlinkColor                        : #06010c
referrer                          :
location                          : System.__ComObject
lastModified                      : 01/15/2014 10:36:09
url                               : https://www.google.de/
domain                            : www.google.de
cookie                            : PREF=ID=f25429caad95b241:U=69dbb4965bfe1505:FF=0:TM=1383044914:LM=1385391257:S=sJbU
                                    NIUqFh_xeE29
expando                           : True
charset                           : utf-8
defaultCharset                    : windows-1252
mimeType                          : Chrome HTML Document
fileSize                          : 139745
fileCreatedDate                   : 01/15/2014
fileModifiedDate                  : 01/15/2014
fileUpdatedDate                   :
security                          : Für diesen Dokumententyp gibt es kein Sicherheitszertifikat.
protocol                          : HyperText Transfer Protocol with Privacy
nameProp                          : Google
onhelp                            :
onclick                           :
ondblclick                        :
onkeyup                           :
onkeydown                         :
onkeypress                        :
onmouseup                         :
onmousedown                       :
onmousemove                       :
onmouseout                        :
onmouseover                       :
onreadystatechange                :
onafterupdate                     :
onrowexit                         :
onrowenter                        :
ondragstart                       :
onselectstart                     :
parentWindow                      : System.__ComObject
styleSheets                       : System.__ComObject
onbeforeupdate                    :
onerrorupdate                     :
documentElement                   : System.__ComObject
uniqueID                          : ms__id1
onrowsdelete                      :
onrowsinserted                    :
oncellchange                      :
ondatasetchanged                  :
ondataavailable                   :
ondatasetcomplete                 :
onpropertychange                  :
dir                               :
oncontextmenu                     :
onstop                            :
parentDocument                    :
enableDownload                    :
baseUrl                           :
inheritStyleSheets                :
onbeforeeditfocus                 :
onselectionchange                 :
namespaces                        : System.__ComObject
media                             :
oncontrolselect                   :
URLUnencoded                      : https://www.google.de/
onmousewheel                      :
doctype                           : System.__ComObject
implementation                    : System.__ComObject
onfocusin                         :
onfocusout                        :
onactivate                        :
ondeactivate                      :
onbeforeactivate                  :
onbeforedeactivate                :
compatMode                        : CSS1Compat
nodeType                          : 9
parentNode                        :
childNodes                        : System.__ComObject
attributes                        :
nodeName                          : #document
nodeValue                         :
firstChild                        : System.__ComObject
lastChild                         : System.__ComObject
previousSibling                   :
nextSibling                       :
ownerDocument                     :
IHTMLDocument2_Script             : System.__ComObject
IHTMLDocument2_all                : System.__ComObject
IHTMLDocument2_body               : System.__ComObject
IHTMLDocument2_activeElement      : System.__ComObject
IHTMLDocument2_images             : System.__ComObject
IHTMLDocument2_applets            : System.__ComObject
IHTMLDocument2_links              : System.__ComObject
IHTMLDocument2_forms              : System.__ComObject
IHTMLDocument2_anchors            : System.__ComObject
IHTMLDocument2_title              : Google
IHTMLDocument2_scripts            : System.__ComObject
IHTMLDocument2_designMode         : Inherit
IHTMLDocument2_selection          : System.__ComObject
IHTMLDocument2_readyState         : complete
IHTMLDocument2_frames             : System.__ComObject
IHTMLDocument2_embeds             : System.__ComObject
IHTMLDocument2_plugins            : System.__ComObject
IHTMLDocument2_alinkColor         : #dd4b39
IHTMLDocument2_bgColor            : #ffffff
IHTMLDocument2_fgColor            : #222222
IHTMLDocument2_linkColor          : #01020c
IHTMLDocument2_vlinkColor         : #06010c
IHTMLDocument2_referrer           :
IHTMLDocument2_location           :
IHTMLDocument2_lastModified       : 01/15/2014 10:36:10
IHTMLDocument2_url                : https://www.google.de/
IHTMLDocument2_domain             : www.google.de
IHTMLDocument2_cookie             : PREF=ID=f25429caad95b241:U=69dbb4965bfe1505:FF=0:TM=1383044914:LM=1385391257:S=sJbU
                                    NIUqFh_xeE29
IHTMLDocument2_expando            : True
IHTMLDocument2_charset            : utf-8
IHTMLDocument2_defaultCharset     : windows-1252
IHTMLDocument2_mimeType           : Chrome HTML Document
IHTMLDocument2_fileSize           : 139745
IHTMLDocument2_fileCreatedDate    : 01/15/2014
IHTMLDocument2_fileModifiedDate   : 01/15/2014
IHTMLDocument2_fileUpdatedDate    :
IHTMLDocument2_security           : Für diesen Dokumententyp gibt es kein Sicherheitszertifikat.
IHTMLDocument2_protocol           : HyperText Transfer Protocol with Privacy
IHTMLDocument2_nameProp           : Google
IHTMLDocument2_onhelp             :
IHTMLDocument2_onclick            :
IHTMLDocument2_ondblclick         :
IHTMLDocument2_onkeyup            :
IHTMLDocument2_onkeydown          :
IHTMLDocument2_onkeypress         :
IHTMLDocument2_onmouseup          :
IHTMLDocument2_onmousedown        :
IHTMLDocument2_onmousemove        :
IHTMLDocument2_onmouseout         :
IHTMLDocument2_onmouseover        :
IHTMLDocument2_onreadystatechange :
IHTMLDocument2_onafterupdate      :
IHTMLDocument2_onrowexit          :
IHTMLDocument2_onrowenter         :
IHTMLDocument2_ondragstart        :
IHTMLDocument2_onselectstart      :
IHTMLDocument2_parentWindow       : System.__ComObject
IHTMLDocument2_styleSheets        : System.__ComObject
IHTMLDocument2_onbeforeupdate     :
IHTMLDocument2_onerrorupdate      :
IHTMLDocument3_documentElement    : System.__ComObject
IHTMLDocument3_uniqueID           : ms__id2
IHTMLDocument3_onrowsdelete       :
IHTMLDocument3_onrowsinserted     :
IHTMLDocument3_oncellchange       :
IHTMLDocument3_ondatasetchanged   :
IHTMLDocument3_ondataavailable    :
IHTMLDocument3_ondatasetcomplete  :
IHTMLDocument3_onpropertychange   :
IHTMLDocument3_dir                :
IHTMLDocument3_oncontextmenu      :
IHTMLDocument3_onstop             :
IHTMLDocument3_parentDocument     :
IHTMLDocument3_enableDownload     :
IHTMLDocument3_baseUrl            :
IHTMLDocument3_childNodes         : System.__ComObject
IHTMLDocument3_inheritStyleSheets :
IHTMLDocument3_onbeforeeditfocus  :
IHTMLDocument4_onselectionchange  :
IHTMLDocument4_namespaces         : System.__ComObject
IHTMLDocument4_media              :
IHTMLDocument4_oncontrolselect    :
IHTMLDocument4_URLUnencoded       : https://www.google.de/
IHTMLDocument5_onmousewheel       :
IHTMLDocument5_doctype            : System.__ComObject
IHTMLDocument5_implementation     : System.__ComObject
IHTMLDocument5_onfocusin          :
IHTMLDocument5_onfocusout         :
IHTMLDocument5_onactivate         :
IHTMLDocument5_ondeactivate       :
IHTMLDocument5_onbeforeactivate   :
IHTMLDocument5_onbeforedeactivate :
IHTMLDocument5_compatMode         : CSS1Compat
IHTMLDOMNode_nodeType             :
IHTMLDOMNode_parentNode           :
IHTMLDOMNode_childNodes           :
IHTMLDOMNode_attributes           :
IHTMLDOMNode_nodeName             :
IHTMLDOMNode_nodeValue            :
IHTMLDOMNode_firstChild           :
IHTMLDOMNode_lastChild            :
IHTMLDOMNode_previousSibling      :
IHTMLDOMNode_nextSibling          :
IHTMLDOMNode2_ownerDocument       :
Bei dem selben Befehl auf einem anderen PC bekomme ich nur "System.__ComObejct" zurück.

Was mach ich falsch? Was fehlt auf den anderen PCs?
Mein PC:
Win 8.1
IE 11
PS 3

Andere PC:
Server 2008R2
Server 2012
Server 2012R2
Windows 8.1
IE 9-11
PS 2-3

Content-Key: 226730

Url: https://administrator.de/contentid/226730

Ausgedruckt am: 28.03.2024 um 19:03 Uhr

Mitglied: colinardo
colinardo 15.01.2014 aktualisiert um 11:43:39 Uhr
Goto Top
Hi,
du brauchst zuerst mal zwingend PS3.0 um auf das COM-Object des IE11 zuzugreifen.
Andere PC:
...
IE 9-12
PS 2-3
Öhm, woher hast du den IE 12 den gibts doch noch gar nicht face-wink
Dann solltest du zusätzlich den ProtectedMode des IE abschalten, und das Script als Admin starten.

siehe dazu auch:

Grüße Uwe
Mitglied: TBroecker
TBroecker 15.01.2014 um 11:58:42 Uhr
Goto Top
Danke!

ka wie ich auf Version 12 gekommen bin^^

Also als Admin hab ich das schon die ganze Zeit gestartet. Powershell V3 ist vorhanden (Win 8.1 hat sogar V4).
ProtectedMode an oder aus interessiert den Befehl auch nicht.

Was scheinbar hilft ist die Kompatibilitätsansicht zu aktivieren. Allerdings ist diese auf meinem PC aus... Nachdem ich die auf den anderen PCs aktiviert hab, funktioniert mein Script - Auch wenn die Seite dabei sehr bescheuert aussieht.
Mitglied: colinardo
colinardo 15.01.2014 um 12:03:00 Uhr
Goto Top
Mitglied: TBroecker
TBroecker 15.01.2014 um 14:34:43 Uhr
Goto Top
Das Problem war eine fehlenden Visual Studio Installation. Ich habe auf Visual Studio2013 Express installiert. Danach funktioniert alles.
Vermutlich reichen auch die Visual Studio Komponenten die beim SQL Management Studio mitgeliefert werden.