Update samy.ps1

This commit is contained in:
2025-12-11 15:38:28 -05:00
parent 70f7680810
commit 88442ba62c

View File

@@ -158,24 +158,43 @@ $Script:SamyBranch = 'beta' # or 'main'
#> #>
#region Safely bypass Restricted Execution Policy #region Safely bypass Restricted Execution Policy
# ─── Safely bypass Restricted Execution Policy ─── # ─── Safely bypass Restricted Execution Policy ───
#region Safely bypass Restricted Execution Policy
# Safely bypass Restricted Execution Policy
if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage' -or if ($ExecutionContext.SessionState.LanguageMode -ne 'FullLanguage' -or
(Get-ExecutionPolicy) -eq 'Restricted') { (Get-ExecutionPolicy) -eq 'Restricted') {
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
$argList = @()
foreach ($a in $args) {
if ($a -is [string]) {
# Quote and escape any existing quotes
$escaped = $a.Replace('"','`"')
$argList += "`"$escaped`""
} else {
$argList += $a.ToString()
}
}
$argString = $argList -join ' '
if ($PSCommandPath) { if ($PSCommandPath) {
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "`"$PSCommandPath`"" # Script saved on disk: re-run same file with same args
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "`"$PSCommandPath`"" $argString
} else { } else {
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& { iwr 'https://samy.svstools.com' -UseBasicParsing | iex }" # iwr | iex scenario: re-download SAMY and apply same args
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& { iwr 'https://samy.svstools.ca' -UseBasicParsing | iex } $argString"
} }
exit exit
} }
# ─── TLS and silent install defaults ─── # TLS and silent install defaults
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
$ConfirmPreference = 'None' $ConfirmPreference = 'None'
#endregion Safely bypass Restricted Execution Policy
#endregion Safely bypass Restricted Execution Policy #endregion Safely bypass Restricted Execution Policy
function Invoke-ScriptAutomationMonkey { function Invoke-ScriptAutomationMonkey {