PowerShell: Downloading File Error ‘Internet Explorer engine is not available’

Error Message:

PS C:\temp> wget http://download.windowsupdate.com/d/msdownload/update/software/secu/2022/01/windows10.0-kb5009546-x64_d3ab97e9f811d7bf19c268e5e6b5e00e92e110ed.msu
wget : 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
+ wget http://download.windowsupdate.com/d/msdownload/update/software/s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
    + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Work-around

$url='http://download.windowsupdate.com/d/msdownload/update/software/secu/2022/01/windows10.0-kb5009546-x64_d3ab97e9f811d7bf19c268e5e6b5e00e92e110ed.msu'
Invoke-WebRequest -Uri $url -UseBasicParsing

Explanation:
The ‘ UseBasicParsing ‘ uses the response object for HTML content, bypassing Document Object Model (DOM) parsing. When Internet Explorer is not installed, such as on a Server Core installation of a Windows Server operating system, this parameter is required. (Source: Microsoft)

Error Message if File is Large

wget : Array dimensions exceeded supported range.
At line:1 char:1
+ wget http://download.windowsupdate.com/d/msdownload/update/software/s ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-WebRequest], OutOfMemoryException
    + FullyQualifiedErrorId : System.OutOfMemoryException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Use BitsTransfer

$fileURL = "http://download.windowsupdate.com/d/msdownload/update/software/secu/2022/01/windows10.0-kb5009546-x64_d3ab97e9f811d7bf19c268e5e6b5e00e92e110ed.msu"
$output = "C:\Temp\jan-2022-rollup.msu"

Import-Module BitsTransfer
Start-BitsTransfer -Source $fileURL -Destination $output

Leave a Reply

Your email address will not be published. Required fields are marked *