You can tag your PowerShell script as requiring a particular version:
#requires -version 2.0
You can put extra help text in your PowerShell script:
<#
.SYNOPSIS
Frobnicates the blargnozzle.
#>
Unfortunately, they don't appear to play nice:
#requires
on line 1, Get-Help Frob-Blargnozzle.ps1
doesn't display the synopsis, only the parameter summary.#requires
on any line other than line one, even if immediately after the <# ... #>
comment, it is ignored.Suggestions?
As a scripting language, PowerShell is commonly used for automating the management of systems. It is also used to build, test, and deploy solutions, often in CI/CD environments. PowerShell is built on the . NET Common Language Runtime (CLR).
PowerShell is a more advanced version of cmd. It is not only an interface but also a scripting language that is used to carry out administrative tasks more easily. Most of the commands executed on cmd can be run on PowerShell as well.
It is the tool to go to, for folks doing DevOps automation tasks in Microsoft technologies. Modern Windows server versions are also mostly controlled via PowerShell cmdlets, the classical GUIs are now being made to act as frontend to those scripts, like the new Web based admin console.
Windows PowerShell is exclusive to Windows -- where it is included by default -- and is built on the . NET Framework. This tutorial uses the latest version of PowerShell -- 7.2. 4 at the time of writing -- on both Windows and Linux.
Try to put #requires -version 2.0
one line up the closing comment #>
<#
.SYNOPSIS
Frobnicates the blargnozzle.
#requires -version 2.0
#>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With