Skip to content

Commit d3cd06b

Browse files
committedFeb 25, 2025··
tweak effectivePolicy
1 parent 5d5db10 commit d3cd06b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎windows_setup.ps1

+7-3
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,13 @@ Write-Host " cd `"$installPath`""
285285
Write-Host "3. Run the script:"
286286
Write-Host " .\customcode-analyzer-generator.ps1"
287287

288-
if ($executionPolicy -eq "Restricted" -or $executionPolicy -eq "AllSigned") {
289-
Write-Host "`nPowerShell is currently blocking script execution!" -ForegroundColor Yellow
290-
Write-Host "Detected Execution Policy: $executionPolicy"
288+
$effectivePolicy = Get-ExecutionPolicy -Scope Process
289+
if ($effectivePolicy -eq "Undefined") {
290+
$effectivePolicy = Get-ExecutionPolicy -Scope CurrentUser
291+
}
292+
if ($effectivePolicy -eq "Restricted" -or $effectivePolicy -eq "AllSigned") {
293+
Write-Host "`nPowerShell is blocking script execution!" -ForegroundColor Yellow
294+
Write-Host "Detected Execution Policy: $effectivePolicy"
291295
Write-Host "`nTo allow the script to run, choose one of these two options:"
292296
Write-Host " - (Recommended) Change policy to allow local scripts:"
293297
Write-Host " Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"

0 commit comments

Comments
 (0)
Please sign in to comment.