Update samy.ps1
This commit is contained in:
17
samy.ps1
17
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user