This script can be used for a wide variety of installation codes. Primarily use is for if you have an MSI file that is too large to upload to the Automox Dashboard. The start-process portion can be modified for other filetypes to use their appropriate invoking programs (such as wusa.exe for MSU files)
Evaluation Code
Exit 1
Remediation Code
# REQUIRES -Version 2.0
$scriptblock = {
$source = 'YOURURLHERE'
$destination = 'YOURMSINAMEHERE'
Try
{
Invoke-WebRequest -Uri "$source" -OutFile "$destination"
Start-Process msiexec.exe -ArgumentList "/i $destination /qn /norestart" -Wait -Passthru
Write-Output "Successfully installed"
return 0
}
Catch
{
Write-Output "Software couldn't be installed"
return -1
}
}
$runScriptBlock = & "$env:SystemRoot\sysnative\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -WindowStyle Hidden -NoProfile -NonInteractive -Command $scriptblock
Exit $runScriptBlock