Day 8
Functions in PowerShell
• Functions provide the interface between your code and the user.They
can define parameters, parameter types, and even provide help,
much like cmdlets. A block of code may be contained within a
function for easy re-use.To create a function, call the function
keyword followed by a name for the function, then include your code
inside a pair of curly braces
Function <function_name> (function_parameters) { <function_body> }
Advanced Functions in PowerShell
• Advanced functions - advanced functions gain access to common
Windows PowerShell parameters and other stuff that makes the
function work like aWindows PowerShell cmdlet.The secret? It is the
use of the [cmdletbinding] tag.
Thank you!

Power shell basics day 8

  • 1.
  • 2.
    Functions in PowerShell •Functions provide the interface between your code and the user.They can define parameters, parameter types, and even provide help, much like cmdlets. A block of code may be contained within a function for easy re-use.To create a function, call the function keyword followed by a name for the function, then include your code inside a pair of curly braces Function <function_name> (function_parameters) { <function_body> }
  • 3.
    Advanced Functions inPowerShell • Advanced functions - advanced functions gain access to common Windows PowerShell parameters and other stuff that makes the function work like aWindows PowerShell cmdlet.The secret? It is the use of the [cmdletbinding] tag.
  • 5.