Post-Setup PowerShell "irm" command

WolfAyro

New Member
Messages
1
Reaction score
0
Hi,
I'd like to add the execution of a script from a URL via PowerShell but it's not working. Could someone explain what I need to do to make it work?

Here are the different methods I've tested:
TaskParameters
powershell"& ([scriptblock]::Create((irm 'https://xxx')))"
powershell-Command "irm 'https://xxx' | iex"
I've hidden the link but it's a direct download link to a .ps1 file. I've tested by executing the command manually and it works, but I can't get it to run automatically with NtLite.


Here's what's inside the preset :

XML:
...
    <Item type="20">
        <Path>powershell</Path>
        <Params>"&amp; ([scriptblock]::Create((irm 'https://xxx')))"</Params>
        <Index>1000</Index>
    </Item>
    <Item type="20">
        <Path>powershell</Path>
        <Params>-Command "irm 'https://xxx' | iex"</Params>
        <Index>1001</Index>
    </Item>
...
 
While you can invoke powershell "irm http://url" commands on a single line, if your script installs or calls another PS module or script, then it must change the current Execution Policy. Otherwise the next module or script is blocked.

You can test your PS command line on a live system, after resetting the Execution Policy back to the default:
Code:
Set-ExecutionPolicy Default
& ([scriptblock]::Create((irm 'https://xxx')))
 
Back
Top