How to use PowerShell Try, Catch and the Write-Verbose and Write-Debug

John Savill's Technical Training May 18, 2021
Video Thumbnail

About

No channel description available.

Video Description

A look at a few key constructs to help handle errors and troubleshooting in your PowerShell scripts. My Files - https://github.com/johnthebrit/RandomStuff/blob/master/PowerShellStuff/HandlingErrors.ps1 https://github.com/johnthebrit/RandomStuff/blob/master/PowerShellStuff/OutputInfoFunc.ps1 Microsoft Document - https://docs.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-exceptions?view=powershell-7.1 00:00 Introduction 00:45 Error variable 02:22 Custom error variable 03:25 Try-Catch 05:01 ErrorAction 06:45 Error details 08:35 Error specific Catch 09:37 ErrorActionPreference 12:09 Errors from cmd.exe 13:25 Messages in scripts 15:09 Using CmdletBinding, Write-Verbose and Write-Debug 17:43 Summary and close

You May Also Like

Upgrade Your Gaming Experience

AI-recommended products based on this video

Loading...
Beelink SER3 Mini Desktop PC with AMD Ryzen 3 3200U 2C/4T, 16GB DDR4 500GB PCIE3.0 X4 SSD, Dual Display Output, WiFi6/BT5.2 W-11 Pro Mini Gaming Computer

Beelink SER3 Mini Desktop PC with AMD Ryzen 3 3200U 2C/4T, 16GB DDR4 500GB PCIE3.0 X4 SSD, Dual Display Output, WiFi6/BT5.2 W-11 Pro Mini Gaming Computer

(239)
$459.00
FREE delivery Sat, Jan 3
Loading...
Beelink SER3 Mini PC, AMD Ryzen 3 3200U(14nm, 2C/4T) up to 3.5GHz, Mini Gaming Computer 16GB DDR4 RAM 500GB PCIE3.0 X4 SSD, Micro PC 4K@60Hz Dual Display, Mini Computer WiFi6/BT5.2/HTPC/W-11 Pro

Beelink SER3 Mini PC, AMD Ryzen 3 3200U(14nm, 2C/4T) up to 3.5GHz, Mini Gaming Computer 16GB DDR4 RAM 500GB PCIE3.0 X4 SSD, Micro PC 4K@60Hz Dual Display, Mini Computer WiFi6/BT5.2/HTPC/W-11 Pro

(1,251)
$329.00
FREE delivery Sat, Jan 3
Loading...
Beelink SER3 Mini PC, AMD Ryzen 3 3200U(up to 3.5GHz) 2C/4T, Mini Computer 16GB DDR4 RAM 500GB SSD, Mini Desktop Computer 4K@60Hz Dual HDMI Display WiFi6/BT5.2/WOL/HTPC/W-11 Pro

Beelink SER3 Mini PC, AMD Ryzen 3 3200U(up to 3.5GHz) 2C/4T, Mini Computer 16GB DDR4 RAM 500GB SSD, Mini Desktop Computer 4K@60Hz Dual HDMI Display WiFi6/BT5.2/WOL/HTPC/W-11 Pro

(815)
$329.00
FREE delivery Sat, Jan 3
50+ bought in past month
Loading...
MSI PRO MP251W E2 24.5-inch IPS 1920 x 1080 (FHD) Gaming Office Monitor, 120Hz, Adaptive-Synch, HDR Ready, HDMI, VGA Port, Display Port,VESA Mountable, Tilt, Speaker, 4-Side Slim Bezel,1ms, White

MSI PRO MP251W E2 24.5-inch IPS 1920 x 1080 (FHD) Gaming Office Monitor, 120Hz, Adaptive-Synch, HDR Ready, HDMI, VGA Port, Display Port,VESA Mountable, Tilt, Speaker, 4-Side Slim Bezel,1ms, White

(447)
$145.99$109.99
$42.66 delivery Jan 12 - 16
100+ bought in past month
Loading...
MSI PRO MP271A E2 27-inch IPS 1920 x 1080 (FHD) Gaming Office Monitor, 120Hz, Free-Sync, HDMI, DisplayPort, VGA Port, VESA Mountable, Tilt, Speaker, 4-Side Slim Bezel 1ms, Black

MSI PRO MP271A E2 27-inch IPS 1920 x 1080 (FHD) Gaming Office Monitor, 120Hz, Free-Sync, HDMI, DisplayPort, VGA Port, VESA Mountable, Tilt, Speaker, 4-Side Slim Bezel 1ms, Black

(360)
$199.99$114.99
$30.75 delivery Jan 7 - 8
200+ bought in past month
Loading...
MSI PRO B650-S WiFi ProSeries Motherboard (Supports AMD Ryzen 7000 Series Processors, AM5, DDR5, PCIe 4.0, M.2 Slots, SATA 6Gb/s, USB 3.2 Gen 2, HDMI/DP, Wi-Fi 6E, 2.5Gbps LAN, ATX)

MSI PRO B650-S WiFi ProSeries Motherboard (Supports AMD Ryzen 7000 Series Processors, AM5, DDR5, PCIe 4.0, M.2 Slots, SATA 6Gb/s, USB 3.2 Gen 2, HDMI/DP, Wi-Fi 6E, 2.5Gbps LAN, ATX)

(372)
$174.99$157.49
FREE delivery Sat, Jan 3
100+ bought in past month
Loading...
MSI Pro MP341CQ, 34" Monitor, 3440 x 1440(UWQHD) VA, 100Hz, TUV Certified Eyesight Protection, 4ms, Displayport, HDMI, Tilt

MSI Pro MP341CQ, 34" Monitor, 3440 x 1440(UWQHD) VA, 100Hz, TUV Certified Eyesight Protection, 4ms, Displayport, HDMI, Tilt

(78)
$279.99$265.99
FREE delivery Sat, Jan 3Only 7 left in stock.
Loading...
Corsair Vengeance LPX 32GB (2 X 16GB) DDR4 3200 (PC4-25600) C16 1.35V Desktop Memory - Black
Best Seller

Corsair Vengeance LPX 32GB (2 X 16GB) DDR4 3200 (PC4-25600) C16 1.35V Desktop Memory - Black

(16,675)
$112.99$101.69
FREE delivery Sun, Aug 10
500+ bought in past month
Loading...
EVGA GeForce GTX 1660 Ti XC Ultra Gaming, 6GB GDDR6, HDB Fan Graphics Card 06G-P4-1267-KR

EVGA GeForce GTX 1660 Ti XC Ultra Gaming, 6GB GDDR6, HDB Fan Graphics Card 06G-P4-1267-KR

(1,163)
$1,970.86
FREE delivery Feb 26 - Mar 5
Loading...
CORSAIR Hydro X Series iCUE Link XH405i Custom Cooling Kit – Hardline Water Cooling Loop – XC7 Elite CPU Water Block – XD5 Elite D5 Pump Res – XR5 360mm Radiator – 3X QX120 RGB Fans

CORSAIR Hydro X Series iCUE Link XH405i Custom Cooling Kit – Hardline Water Cooling Loop – XC7 Elite CPU Water Block – XD5 Elite D5 Pump Res – XR5 360mm Radiator – 3X QX120 RGB Fans

(235)
$879.99
FREE delivery Sun, Aug 24
Loading...
Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black
Best Seller

Logitech G203 Wired Gaming Mouse, 8,000 DPI, Rainbow Optical Effect LIGHTSYNC RGB, 6 Programmable Buttons, On-Board Memory, Screen Mapping, PC/Mac Computer and Laptop Compatible - Black

(17,871)
$27.98$22.38
FREE delivery Tue, Oct 14 on your first order
500+ bought in past month
Loading...
Razer BlackShark V2 X Gaming Headset: 50mm Drivers - Cardioid Mic - Memory Foam Cushion - Lightweight- Comfortable, Noise Isolating Earcups - for PC, PS4, PS5, Switch - 3.5mm Audio Jack - Black ECOLOGO

Razer BlackShark V2 X Gaming Headset: 50mm Drivers - Cardioid Mic - Memory Foam Cushion - Lightweight- Comfortable, Noise Isolating Earcups - for PC, PS4, PS5, Switch - 3.5mm Audio Jack - Black ECOLOGO

(17,449)
$54.98$48.21
FREE delivery Mon, Jan 26
3K+ bought in past month
Loading...
230W Charger Compatible with Razer Blade 14” 15” 16" 17” (2025-2018) RZ09 RTX-3060/3070/3080/4060/4070 Gaming Laptop RC30-0530 RC30-0238 RC30-0248 Replacement Power Adapter

230W Charger Compatible with Razer Blade 14” 15” 16" 17” (2025-2018) RZ09 RTX-3060/3070/3080/4060/4070 Gaming Laptop RC30-0530 RC30-0238 RC30-0248 Replacement Power Adapter

(16)
$67.99
FREE delivery Mon, Feb 16