In my blog post on collaborationpro.com where I showed you how to get a reverse shell on Windows Server 2022 and then demonstrated how ESET removed the file, well, because it was on Windows Server 2022 Core, there is not browser option so I had to put together a quick script to be able to download the MSI for ESET to get it installed. The script will download a setup file from the internet and then save it locally for you.

The script has two places that need to be updated to achieve this as follows:

  • $url – This is where you enter in the url to the file you want to download
  • $localPath – This is where you enter in the path to save the file to

Below is my C:\Installs Directory showing the PFX certificate I copied recently:

Perform a directory listing with PowerShell

After running the script and doing a directory listing, here is the output of the same directory with the file I downloaded:

Directory listing after running a script

Script

Here is the simple script that was put together, I left the path and url in for you to see how it is used:

# Specify the URL of the file you want to download
$url = "https://download.eset.com/com/eset/apps/business/efs/windows/latest/efsw_nt64.msi"

# Specify the local path where you want to save the downloaded file
$localPath = "C:\Installs\efsw_nt64.msi"

# Create a WebClient object to download the file
$webClient = New-Object System.Net.WebClient

# Download the file and save it locally
$webClient.DownloadFile($url, $localPath)

# Dispose of the WebClient object to release resources
$webClient.Dispose()

Write-Host "File downloaded successfully to $localPath"

As shown above, you can see the MSI I wanted and the path I saved the MSI to.

Hope it helps.

    wpChatIcon

    Discover more from Everything-PowerShell

    Subscribe now to keep reading and get access to the full archive.

    Continue reading