Advanced PowerShell Functions: Upping Your Game
When writing large PowerShell scripts or modules, it will eventually become necessary to split up the code into modular pieces. Modularity can be achieved by using basic and advanced PowerShell functions. It also encourages good coding practices. One way to build modular code in PowerShell is to use functions. At their most basic, PowerShell functions allow you to compartmentalize code rather than stringing it all together in one large script.
PowerShell provides two different kinds of functions: basic and advanced. Basic functions are just that: basic. They are the simplest form a function can be. Basic functions do not allow you to do things like accept pipeline input, control streams and so on. For that, we’ll have to write advanced functions. But what makes a basic function “advanced”? Let’s find out.
Advanced functions give you a few advantages: accepting pipeline input, allowing you to use built-in parameters like -Verbose, -ErrorAction, -ErrorVariable and so on. They also allow you to use advanced parameter attributes and write help content as well…
Read the full article at Ipswitch.