Update samy.ps1
This commit is contained in:
25
samy.ps1
25
samy.ps1
@@ -158,24 +158,43 @@ $Script:SamyBranch = 'beta' # or 'main'
|
||||
#>
|
||||
#region 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
|
||||
(Get-ExecutionPolicy) -eq 'Restricted') {
|
||||
|
||||
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) {
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
# ─── TLS and silent install defaults ───
|
||||
# TLS and silent install defaults
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
$ProgressPreference = 'SilentlyContinue'
|
||||
$ConfirmPreference = 'None'
|
||||
#endregion Safely bypass Restricted Execution Policy
|
||||
|
||||
#endregion Safely bypass Restricted Execution Policy
|
||||
|
||||
function Invoke-ScriptAutomationMonkey {
|
||||
|
||||
Reference in New Issue
Block a user