Since PowerShell version 3 there has been very well defined comment based help comment block: https://technet.microsoft.com/en-us/library/hh847834.aspx What I would like to know is there a standard for versioning a PowerShell script like there is in C#? I am asking as I am about to publish a module and the psd1 file has:
# Version number of this module.
ModuleVersion = '1.0.0.0'
In my own scripts I use the following standard:
<#
.SYNOPSIS
<Synopsis goes here>.
.DESCRIPTION
<Description goes here>.
.EXAMPLE
Example.ps1
Runs with default parameters
.NOTES
Author : Glen Buktenica
Version : 1.0.0.0 20160725 Initial Build
#>
At the time of writing (and asking the question) - Afaik there's no "official" standard of doing this.
The most frequent used way I've seen people versioning their scripts are as you are doing under the .NOTES section
.NOTES
Version: 1.0
Author: <Name>
Creation Date: <Date>
Purpose/Change: Initial script development
I've also seen headers such as this on top of the script just after #requires statements. Ex: #script 1.0 - though less frequent
Since this is meta information and your script version will follow your module version, I'd say it should be a good solution to keep doing what you're already are doing (and what I've seen most people doing already).
Update: for newer versions of Powershell - look at the new-scriptfileinfo cmdlet:(https://docs.microsoft.com/en-us/powershell/module/powershellget/new-scriptfileinfo?view=powershell-6)
Use the ScriptFileInfo
cmdlets, like: New-ScriptFileInfo
<#PSScriptInfo
.VERSION 1.0.1
.GUID 54688e75-298c-4d4b-a2d0-1234567890ab
.AUTHOR iRon
.DESCRIPTION Your description
.COMPANYNAME
.COPYRIGHT
.TAGS PowerShell Version
.LICENSEURI https://github.com/LICENSE
.PROJECTURI https://github.com/
.ICONURI https://Icon.png
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
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