Monthly Archive



You may have seen this at the top of scripts or modules

#Requires –Version 3


This will stop the script running if the PowerShell version is 2.0 or below.

Other options are available


#Requires –PSSnapin      can be used to force the loading of a snapin


#Requires –Modules     can be used to force importing of modules


#Requires –Shellid    controls which shells the script can run in.  Default PowerShell installs have the ISE and console


#Requires –RunAsAdminstrator  - script must be running in instance of PowerShell with elevated privileges


These provide a simple and easy way to control execution without lots of code. I particularly like the last one.

Leave a Reply