🔴Error Handling in PowerShell

Опубликовано: 14 Октябрь 2024
на канале: PDQ
942
17

https://live.pdq.com/

Get-Error(ps7) :25

Terminating vs non-terminating errors. 4:20
$erroractionpreference

Question: Can you reset the error count during a session? 8:04

Flow Control. 9:00

Ternary operators(ps7) 13:40

Question: Is there a way to install all pending Win10 updates with PowerShell and PDQ? 16:00

Try/catch. 17:20

Question: Is it possible to use PowerShell steps in a deployment to conditionally execute subsequent steps or kick off other deployments? 22:22

Catching specific error types. 23:40

Question: Now we have 3 versions of PowerShell - 5.1 being standard in Windows, PowerShell Core is kinda-usable in Unix, and PowerShell 7 is all-new with shiny things included but not compatible with anything. So, how useful is it? 28:14

Question: Can we have the error display only show the error and not the details? 29:40

Question: If you write a function within a script is it best practice to handle errors within the function or wrap the function in a Try Catch within the script? Also, where do you get your PowerShell shirts? 30:48