diff --git a/tiny11Coremaker.ps1 b/tiny11Coremaker.ps1 index 2ff4a04..39c9ce7 100644 --- a/tiny11Coremaker.ps1 +++ b/tiny11Coremaker.ps1 @@ -1,12 +1,14 @@ # Enable debugging Set-PSDebug -Trace 1 -# Check if PowerShell execution is restricted -if ((Get-ExecutionPolicy) -eq 'Restricted') { - Write-Host "Your current PowerShell Execution Policy is set to Restricted, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)" +# Check if PowerShell execution is Restricted or AllSigned or Undefined +$needchange = @("AllSigned", "Restricted", "Undefined") +$curpolicy = Get-ExecutionPolicy +if ($curpolicy -in $needchange) { + Write-Host "Your current PowerShell Execution Policy is set to $curpolicy, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)" $response = Read-Host if ($response -eq 'yes') { - Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm:$false + Set-ExecutionPolicy RemoteSigned -Scope Process -Confirm:$false } else { Write-Host "The script cannot be run without changing the execution policy. Exiting..." exit diff --git a/tiny11maker.ps1 b/tiny11maker.ps1 index d2c3cf4..1f1a613 100644 --- a/tiny11maker.ps1 +++ b/tiny11maker.ps1 @@ -14,12 +14,14 @@ if (-not $ScratchDisk) { Write-Output "Scratch disk set to $ScratchDisk" -# Check if PowerShell execution is restricted -if ((Get-ExecutionPolicy) -eq 'Restricted') { - Write-Host "Your current PowerShell Execution Policy is set to Restricted, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)" +# Check if PowerShell execution is Restricted or AllSigned or Undefined +$needchange = @("AllSigned", "Restricted", "Undefined") +$curpolicy = Get-ExecutionPolicy +if ($curpolicy -in $needchange) { + Write-Host "Your current PowerShell Execution Policy is set to $curpolicy, which prevents scripts from running. Do you want to change it to RemoteSigned? (yes/no)" $response = Read-Host if ($response -eq 'yes') { - Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm:$false + Set-ExecutionPolicy RemoteSigned -Scope Process -Confirm:$false } else { Write-Host "The script cannot be run without changing the execution policy. Exiting..." exit