diff --git a/samy.ps1 b/samy.ps1 index 339e205..cabce80 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -19,11 +19,13 @@ if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage' -or if ($PSCommandPath) { powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$PSCommandPath" @argList } else { - # IMPORTANT: pass args AFTER -Command so they become $args in the downloaded script - $bootstrap = "& { iwr 'https://samybeta.svstools.ca' -UseBasicParsing | iex }" + + # Download -> create ScriptBlock -> INVOKE it with @args so $args survives the relaunch + $bootstrap = "& { `$sb = [ScriptBlock]::Create((Invoke-WebRequest 'https://samybeta.svstools.ca' -UseBasicParsing).Content); & `$sb @args }" powershell.exe -NoProfile -ExecutionPolicy Bypass -Command $bootstrap @argList } + exit }