The PoSh family require lots of things. Food, warmth and shelter seem to be at the top of their list. Attention is up there, too.
Interestingly, the PoSh chickens have similar requirements... although, PowerShell still doesn't figure on THEIR list.
More interestingly, scripts have requirements: a certain script may require administrative privileges, another the Azure PowerShell module. Scripts never want chicken feed, though.
Demands, Demands, Demands
Why am I telling you this?
Well, in PowerShell, #Requires statements are an excellent way of performing prerequisite checking. An error will be thrown if the condition in the #Requires statement isn't met.
Here's an example error:
The #Requires statement that generated the above message looked like this:
#Requires -Version 4
It was placed at the top of the sample script. Here's a couple of other #Requires statements I've used recently:
#Requires -Modules ActiveDirectory,GroupPolicy
The ability to perform prerequisite checking this easily is yet another reason why PowerShell is so splendid!
Maslow's Hierarchy of Needs