Azure Automation で Invoke-WebRequest したあと Parse してくれない件

Azure Automation で wget したあと、プロパティが参照できなくて毎回同じ場所で時間を浪費してるのでメモ。

$Result = Invoke-WebRequest "http://www.contoso.com"
$Result.Links.href
Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or
Internet Explorer's first-launch configuration is not complete. Specify the UseBasicParsing parameter and try again.
At line:1 char:1
+ Invoke-WebRequest "https://bangumi.org/epg/td?broad_cast_date=2019031 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
+ FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

UseBasicParsing を使って、最小限のパースだけで我慢しましょう。

$Result = Invoke-WebRequest "http://www.contoso.com" -UseBasicParsing
$Result.Links.href

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください