Using Powershell to download and run exe file

Viewed 46

I am trying to download Malwarebytes Anti-Rootkit Beta but my PowerShell script throws the error below. How do I fix this?

My Script:

$url = "https://data-cdn.mbamupdates.com/web/mbar-1.10.3.1001.exe"
$outpath = "$PSScriptRoot/mbar-1.10.3.1001.exe"

$wc = New-Object System.Net.WebClient
$wc.DownloadFile($url, $outpath)

$args = @("Comma","Separated","Arguments")
Start-Process -Filepath "$PSScriptRoot/mbar-1.10.3.1001.exe" -ArgumentList $args

The Error:

Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:8 char:1
+ Start-Process -Filepath "$PSScriptRoot/mbar-1.10.3.1001.exe" -Argumen ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
0 Answers
Related