PowerShell supports a number of #requires statements. Technically they are comments but PowerShell checks the requirements, and if they are not met, it won't run a script. In addition, #requires statements tell you quickly what a script needs to run.
#requires -Modules PrintManagement #requires -Version 3 #Requires -RunAsAdministrator
#requires statements need to be the first statements in a script, and they work only for saved scripts.
ReTweet this Tip!
Posted Feb 19 2016, 06:00 AM by ps1