I have a PowerShell script statically hosted on my website and I want to run it on my machine without manually downloading it. So I do this:
iwr https://mywebsite/test.ps1 | iex
Which works perfectly until you don't need to pass any arguments. But if I need to use arguments what options do I have?
As a workaround I can use variables instead of arguments like so:
$arg=$true; iwr https://mywebsite/test.ps1 | iex
but this is not ideal.
Is there any better way to do this?