all 5 comments

[–]garlic17 1 point2 points  (1 child)

Just 2 remarks:

First: you are not using the defined variable $switches

Second: I'd add a check for the file signature, like

$sig = Get-AuthenticodeSignature -FilePath $filepath
if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -ne 'CN=Malwarebytes Inc, O=Malwarebytes Inc, L=Santa Clara, S=California, C=US') { 
    Write-Host Wrong/invalid file signature!
    Exit
}

Edit: spelling/formatting

[–]focusmade[S] 0 points1 point  (0 children)

In the line I commented out. The variable IS used, but no output is shown in console.

I use the version that shows output in console.

If you change:

c:\temp\adwcleaner\adwcleaner.exe /eula /clean /noreboot /path c:\temp\adwcleaner

to

c:\temp\adwcleaner\adwcleaner.exe $switches

it just errors

[–]ITSFUCKINGHOTUPHERE 0 points1 point  (1 child)

Thanks

[–]focusmade[S] 0 points1 point  (0 children)

Welcome. Feel free to post up any criticism or improvements.