Mike L.
Mike L.

Reputation: 31

InvokeWebrequest says it can't connect to server, but a normal web browser works fine

I'm trying to write a better script for my RMM to install Cove Data Protection. I wanted to pass a filename because for silent install the file needs a specific filename so it conects properly. I have a variable for the output file to be the bm#xyz123abc456#.exe that it wants.

Invoke-WebRequest 'https://cdn.cloudbackup.management/maxdownloads/mxb-windows-x86_x64.exe' -OutFile $coveFilename

However, I get:

Invoke-WebRequest : Unable to connect to the remote server
At line:1 char:1
+ Invoke-WebRequest 'https://cdn.cloudbackup.management/maxdownloads/mx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

However, I can put that exact link into any web browser and it downloads the file no issue.

I was expecting it to download the file and write the file as the specific filename it needs. Web browser works perfectly, and manually renaming the file works perfectly. So why is powershell having an issue?

This is all machines, all locations, regardless of firewalls and such. All Windows Server 2022 or Windows 11 Pro.

Upvotes: 2

Views: 1287

Answers (1)

Mike L.
Mike L.

Reputation: 31

Never mind.... ThreatLocker ringfencing PowerShell!

Upvotes: 1

Related Questions