One of my first memories as a PowerShell newbie is this error message.

execution policy

A few minutes of Googling around and figuring out what this meant yielded this next statement.

Set-ExecutionPolicy 'Unrestricted'

...and that's where it was left. Now, the above statement is so second nature to me I don't even think twice about it. Why? Because I actually read each script I download from the Internet prior to running on my production network. I don't have to "trust" the source if I can read what it's doing prior to executing it.

Let's back up first. What is a PowerShell execution policy and why am I hating on it? I believe nailed the basics. �I'm not going to go much more into the definition. �What I am going to go into is why it's something you don't need to concern yourself with if it's just you creating scripts to make your job easier.

I'm not referring to larger organizations that have multiple people using Powershell every day and downloading scripts from the Internet everyday. �I'm talking about sys admins like myself that are probably the only one in their organization that uses PowerShell on a regular basis.

I'm a details kinda guy. �When I learn, I learn the details. �When this execution policy error popped up on me I immediately went into learn mode. �What is an execution policy? �How do I make the error go away? �What's the best execution policy to set? �The unrestricted policy make the error go away but is that really the right thing to do?

My point is don't think so much into it. �If you're a beginner, just set it to unrestricted and be done with it. �Once you've taken off the training wheels you can then start to worry about signing scripts with certificates and enforcing execution policies with GPOs, for example. �If you love Powershell and continue to use it every day it'll come back up some time.

If you'd like to get a real-world example of this I briefly go over setting your execution policy in Section 3 of my PowerShell course Powershell: �A Getting Started Guide for IT Admins. �This is an excellent resource for anyone wanting to learn Powershell and to learn the basics of programming.

Join the Jar Tippers on Patreon

It takes a lot of time to write detailed blog posts like this one. In a single-income family, this blog is one way I depend on to keep the lights on. I'd be eternally grateful if you could become a Patreon patron today!

Become a Patron!