added bypass mode for restricted execution policies
This commit is contained in:
@@ -136,6 +136,27 @@
|
|||||||
& ([ScriptBlock]::Create((iwr 'sm.svstools.com').Content)) -Cleanup
|
& ([ScriptBlock]::Create((iwr 'sm.svstools.com').Content)) -Cleanup
|
||||||
|
|
||||||
#>
|
#>
|
||||||
|
#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
|
||||||
|
|
||||||
|
if ($PSCommandPath) {
|
||||||
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "`"$PSCommandPath`""
|
||||||
|
} else {
|
||||||
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "& { iwr 'https://sm.svstools.com' -UseBasicParsing | iex }"
|
||||||
|
}
|
||||||
|
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
# ─── TLS and silent install defaults ───
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
|
$ConfirmPreference = 'None'
|
||||||
|
#endregion Safely bypass Restricted Execution Policy
|
||||||
|
|
||||||
function Invoke-ScriptMonkey {
|
function Invoke-ScriptMonkey {
|
||||||
|
|
||||||
@@ -1658,6 +1679,7 @@ function Install-DattoRMM {
|
|||||||
}
|
}
|
||||||
#endregion EntryPoint: Define Invoke-ScriptMonkey
|
#endregion EntryPoint: Define Invoke-ScriptMonkey
|
||||||
|
|
||||||
|
|
||||||
#region — guarantee NuGet provider is present without prompting
|
#region — guarantee NuGet provider is present without prompting
|
||||||
# ─── NuGet + PSGallery bootstrap (safe & silent) ───
|
# ─── NuGet + PSGallery bootstrap (safe & silent) ───
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user