From 1bf7dff3e112cb75e4c2814d6ceafa48d020fc70 Mon Sep 17 00:00:00 2001 From: Stephan Yelle Date: Sat, 20 Dec 2025 16:09:23 -0500 Subject: [PATCH] Update samy.ps1 --- samy.ps1 | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/samy.ps1 b/samy.ps1 index f23d3b2..a4cf1c2 100644 --- a/samy.ps1 +++ b/samy.ps1 @@ -174,23 +174,14 @@ if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage' -or Write-Host "[Info] Relaunching with ExecutionPolicy Bypass..." -ForegroundColor Yellow - # Rebuild the original argument list as a string to pass through - $argList = @() - foreach ($a in $args) { - $argList += [string]$a - } + # Build token list (NO manual quoting) + $argList = foreach ($a in $args) { [string]$a } - # Only needed for the -Command path (string has to be re-parsed) - $argString = ($argList | ForEach-Object { - '"' + ($_ -replace '"','`"') + '"' - }) -join ' ' if ($PSCommandPath) { - # FIX: do NOT pass $argString as one argument - # You want PowerShell to see each token separately. powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$PSCommandPath" @argList } else { - # Here, argString is fine because -Command is a single string + $argString = ($argList | ForEach-Object { '"' + ($_ -replace '"','`"') + '"' }) -join ' ' powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& { iwr 'https://samy.svstools.ca' -UseBasicParsing | iex } $argString" } exit @@ -2072,7 +2063,7 @@ function Install-DattoRMM { & $fn -Context $Context } else { - & $fn $Context # or & $fn with no args, up to you + & $fn } return }