Since the 20H2
build of Windows 10 came out, if I want to run a script without copying and pasting it into a PowerShell window, I have to write the following command:
Set-ExecutionPolicy -ExecutionPolicy ByPass -Scope Process -Force
I don't want to turn off the default behavior, since it prevents scripts from being run by accident or maliciously.
But I'd also like to be able to just open a PowerShell window as my administrator account, and execute .\somescript.ps1
so that it runs.
Is it secure to place the line above in my powershell profile so I don't have to manually run it every time I open Powershell as my Admin account, provided I still have UAC turned on (a.k.a. still have to type my password when opening a Powershell as Admin)?
Set-ExecutionPolicy RemoteSigned