Functions allow you to group Powershell statements and enable you to not only combine these statements but also call them from different environments, if they are configured properly. The extra power comes from the fact that you can essentially create new cmdlets and persist them in scripts or in something called PowerShell profile and run them from anywhere either as a script, call them from other scripts or from the command line across all sessions.
Before we do this though we need to learn about a couple of other Powershell elements first.
- Powershell Profile
- Powershell Modules
What is a PowerShell profile
What is a PowerShell module
- Define PowerShell functions
- Understand what PS-Profile and PS-Modules have to do with functions
- Create a profile
- Create a function
- Call functions in different ways.