Update samy.ps1

This commit is contained in:
2025-12-20 16:09:23 -05:00
parent 14ea4f025f
commit 1bf7dff3e1

View File

@@ -174,23 +174,14 @@ if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage' -or
Write-Host "[Info] Relaunching with ExecutionPolicy Bypass..." -ForegroundColor Yellow Write-Host "[Info] Relaunching with ExecutionPolicy Bypass..." -ForegroundColor Yellow
# Rebuild the original argument list as a string to pass through # Build token list (NO manual quoting)
$argList = @() $argList = foreach ($a in $args) { [string]$a }
foreach ($a in $args) {
$argList += [string]$a
}
# Only needed for the -Command path (string has to be re-parsed)
$argString = ($argList | ForEach-Object {
'"' + ($_ -replace '"','`"') + '"'
}) -join ' '
if ($PSCommandPath) { 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 powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$PSCommandPath" @argList
} else { } 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" powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& { iwr 'https://samy.svstools.ca' -UseBasicParsing | iex } $argString"
} }
exit exit
@@ -2072,7 +2063,7 @@ function Install-DattoRMM {
& $fn -Context $Context & $fn -Context $Context
} }
else { else {
& $fn $Context # or & $fn with no args, up to you & $fn
} }
return return
} }