A function is a block of code that has a name and it has a property that it is reusable. Like in other programming language we can create function in powershell as well, it is basically groups a number of program statements into a unit and function is given name to it.ry-Catch-Finally. You can intercept any error in try, catch and finally statements. PowerShell supports try/catch/finally, that should feel familiar to all java, .Net developers. PowerShell Version 1 introduced the trap statement that still works; I prefer try/catch/finally.