I use Set-ExecutionPolicy RemoteSigned
and download some scripts and modules. These are my scripts so they are not signed. I could use Bypass
or RemoteSigned
or Unrestricted
. I feel that Unrestricted
feels a bit over the top so I got with RemoteSigned
and indeed, even though my scripts are not signed, I can download them and run them... for a while. Then, "Windows Defender" catches up and completely deletes my scripts. My questions are:
After I download a script, is there a programmatic way with PowerShell to instruct Windows Defender to mark that script on the exclusion list?
Would you say that
Unrestricted
is a bit unsafe? If so, what is the process of making these scripts signed (or self-signed?), or is this not possible? i.e. Set toUnrestricted
so that files are not nuked, then download the file, then somehow put it on an exclusion list, then set the ExecutionPolicy back toRemoteSigned
?