Error handling is an important part of scripting. There is nothing worse than a script ruining your infrastructure, just because of one unhandled exception. It is also important to note that PowerShell does not work with integer-based exit codes like other shells do. PowerShell always returns objects, or it returns $null. Through different exceptions, cmdlets communicate any errors that have occurred.