PowerShell is a great tool that can save the Admin a bunch of time. Creating scripts to do repetitive tasks is nothing new, batch files have been doing it for years. Upgrading scripts to PowerShell is a good idea but when you try to run that script on another system you are confronted with an error.
This isn’t the end of your scripting days, this is just a good way to protect the average PC from running scripts that the user didn’t intend on running. Execution Policies are designed to prevent scripts from running that aren’t
created on the PC that is attempting to run it. Sounds good, but it can really be a pain. There are two ways to get around this and depending on the use of the system you’ll want to use one or the other. You can digitally sign your scripts so
that the computer knows they are safe to run or you can relax the execution policy. I tend to lean more towards changing the execution policy. If you work in a well protected environment it should be generally safe to do so.
Microsoft does a good job of explaining the different execution policies and I strongly suggest reading their TechNet post about it.
A quick overview of the choices are:
To see what your execution policy is just open a PowerShell prompt and enter this command:
click here To change the execution policy of your system you will need to be using an administrative PowerShell prompt. Run this command to change the execution policy to Bypass (This will not prompt any warnings and permits all scripts to run)
Now that your execution policy has been changed you are all set to run your own custom scripts! In another post I’ll discuss how to make this change in a large environment, because running this command on every server is just NOT an option…