Hi all - Apologies as this is about the 10th attempt I’ve made at posting this. I dont know what the anti-spam algorithms are doing, but they really hate me with a passion.
Anyway - I’ve been looking for years to find a way to disable Powershell’s annoying security warnings. Recently I’ve started to script some more, and its gotten to the point now that its making me angry every time I try to debug or write anything.
Is there a way to properly disable the Powerhsell security warnings that pop up every time you run a script? I write all my own scripts, so usually dont bother to sign them or anything (no point) and I often write little scriptlets to help me automate tasks.
Most of what I code is done to automate really basic stuff, or things like a full on server deployment. They rely entirely on zero-touch from the user/admin running them, so this security warning always throws a spanner in the works. I kick off a server deployment using my script for e.g. and come back hours later expecting it to be done only to find it stuck on this infuriating warning screen:
Security warning Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run ? [D] Do not run [R] Run once [S] Suspend [?] Help (default is "D"):
I’ve searched online long and hard for a solution, and nothing I’ve tried seems to do anything with this warning message.
Set-ExecutionPolicy to bypass - does nothing
Setting Intranet zone security for SMB shares (my scripts are stored on our network SMB shares) - does nothing
Setting GPOs to disable POSH security - does nothing
Unblock-File cmd - does nothing
I’ve even attempted using some janky workaround using SysInternals Streams to try and sort the security zones out, but I couldnt figure out what they were trying to achieve with that method - just dont understand it enough.
My question is simple - how do I disable these warnings?
And why is this information so well hidden from Microsoft? I’ve tried to structure my google searches in multiple ways but found nothing that’s helped - either I’m looking in the wrong places, or using some wrong search criteria.