Forum Discussion

Mike_Smith's avatar
5 years ago
Solved

Powershell Download a Collector

I've been working on a Powershell method to download a collector. I'm to the point where I've got content, but no matter how I write the file ($content > "lm.exe", $content | Out-File "lm.exe" (tri...
  • Mike_Moniz's avatar
    5 years ago

    It seems to work for me if I use the -OutFile parameter with Invoke-RestMethod but didn't figure out having it assigned to a variable that is then outputted. I also changed the content type to binary instead of json since you are not looking for json data, but seems LM will send binary data anyway.

    Invoke-RestMethod -Uri $url -Method $Verb -Header $headers -ContentType "application/binary" -OutFile "lm-out.exe" -Verbose