好的,我寫了一個非常強大的PowerShell腳本來安裝和配置SharePoint 2007和SQL 2008.這就是它,請不要評價我。在完成所有這些後,因爲腳本應該是用戶友好的,我開發了一個Web表單來收集輸入並顯示任務進度。愚蠢的是,我在Windows 8.1上編寫了Web表單的所有代碼,甚至沒有測試腳本執行的Server 2008 R2上的基本功能。當我將代碼傳送到服務器時,它幾乎立即發生故障。當我在Windows 7上測試它時,它運行良好。問題與Server 2008 R2上的Internet Explorer ComObject交互
這裏是(W/IE 11)和Windows 7(W/IE 9)在Windows 8.1的行爲:
>$ie = New-Object -ComObject InternetExplorer.Application
>$ie.Navigate('about:blank')
>$ie.visible = $true #Internet explorer is now displayed with a blank page
>$ie.document
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 :
scripts : System.__ComObject
designMode : Inherit
selection : System.__ComObject
readyState : complete
不勝枚舉一會兒....
現在當我運行在服務器2008 R2相同的代碼:
>$ie = New-Object -ComObject InternetExplorer.Application
>$ie.Navigate('about:blank')
>$ie.visible = $true #Internet explorer is now displayed with a blank page
>$ie.document
System.__ComObject
這是一個問題的一點點腳本相當嚴重依賴於寫入和從IE文檔對象閱讀,沒有我需要的是類可用。相反,沒有課程可用,即使是我不需要的課程。
那麼有什麼方法可以訪問Server 2008 R2上的文檔對象嗎?我已經經歷了所有我能想到的安全區域設置(儘管我可能錯過了某些內容),並且我禁用了增強的安全配置和IE保護模式。我所做的任何事似乎都使我能夠訪問文檔。有什麼建議?
這有幫助嗎? http://stackoverflow.com/questions/21197141/internetexplorer-application-com-object-and-windows-2012-in-powershell – DeanOC 2014-09-18 22:38:43
發佈錯誤。 – 2014-09-18 23:43:19
@NathanRice沒有任何錯誤。 PowerShell只是返回OP發佈的內容。 – DeanOC 2014-09-19 04:16:30