My PowerShell template

This is the PowerShell Template I use for 90% of my code:
https://github.com/gbuktenica/PowerShell-Template

PowerShell uses #region and #endregion to tell PowerShell editors that this is a section of code that can be collapsed. PowerShell-Template.ps1 includes a region around the whole Comment block, Parameter block and Function block so that the whole template can be collapsed with one click to show the main entry point as shown:
There are additional regions defined within the header. For more information:

https://blogs.technet.microsoft.com/heyscriptingguy/2015/11/12/use-regions-in-powershell-ise-2/

PowerShell comment blocks for scripts and functions are well defined and are used for the help command.
In PowerShell 5 there are 14 valid comment-based help keywords as defined here:
https://technet.microsoft.com/en-us/library/hh847834.aspx
I only use the following keywords in my template

The Functions Configure-Logs and Export-Logs are used together to create standard and error log files without the need to customise them per script.
Configure-Logs creates files path in the same location as the script with the date appended and starts transcription logging is the -logging switch is used.
If the script was called:
C:\scripts\MyScript.ps1
then the two log paths created would be
C:\scripts\MyScript20160407.log and
C:\scripts\MyScript20160407.err.log

The path is tested to ensure it is writable, if it is not as in the case of a CD-ROM then a fall back path of $env:LOCALAPPDATA\temp\ is used:
C:\Users\bukteng0\AppData\Local\temp\MyScript20160407.log and
C:\Users\bukteng0\AppData\Local\temp\MyScript20160407.err.log

Export-Logs is the last command run in the template. It closes transcription logging if enabled and if standard error ($error in PowerShell) is non zero then writes the error content out to the error log file. Instead of simply piping $error to a file, Export-Logs loops through each error in order and extracts the full string of:
Exception ID
Fully Qualified ID
Script Stack Trace and
The script line number that the error was generated on.

The final function included in the template is the Windows form function as discussed here:
http://blog.buktenica.com/select-gui/