This week topic will be focused on Windows PowerShell Advanced Functions.
In this series:In this post, we'll discuss Standard and Advanced Functions and why you should write advanced functions.
- Standard and Advanced PowerShell Functions by François-Xavier Cat (@LazyWinAdm) (March 30, 2015)
- PowerShell Advanced Functions: Can we build them better? With parameter validation, yes we can! by Mike F. Robbins (@mikefrobbins) (March 31, 2015)
- Dynamic Parameters and Parameter Validation by Adam Bertram (@adbertram) (April 1, 2015)
- Supporting WhatIf and Confirm in Advanced Functions by Jeffery Hicks (@JeffHicks) (April 2, 2015)
- Advanced Help for Advanced Functions by June Blender (@juneb_get_help) (April 3, 2015)
- A Look at Try/Catch in PowerShell by Boe Prox (@proxb) (April 4, 2015)
When you have been working with PowerShell for some time, creating reusable tools is an obvious evolution to avoid writing the same code over and over again. You will want to have modular pieces of code that only do one job and do it well - that’s the role of functions.
Let's suppose you have to accomplish a task that requires multiple lines of code, for example:
# Computer System Get-WmiObject -Class Win32_ComputerSystem # Operating System Get-WmiObject -class win32_OperatingSystem # BIOS Get-WmiObject -class Win32_BIOS