PowerShell Errors and Exceptions Handling

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น • 39

  • @alphabeta4149
    @alphabeta4149 4 ปีที่แล้ว +2

    Probably the clearest and most concise tutorial I've seen on Powershell. Who is this guy?

    • @NancyRileyNuniverse
      @NancyRileyNuniverse 3 ปีที่แล้ว

      Agreed. There are some more well known folks that make these videos and I feel like they just joke and never get to the meat of what we need, immediately. This gentleman rocks at training!!!

  • @5n4keyes
    @5n4keyes 2 ปีที่แล้ว +2

    2 Years later and this was still perfect! made it simple to understand, and exactly what i needed. Thank you.

  • @thecrazzxz3383
    @thecrazzxz3383 3 ปีที่แล้ว +5

    We can say that it was an exceptional tutorial

  • @Cullinan000
    @Cullinan000 5 ปีที่แล้ว +9

    These videos are pure gold. Thank you!

  • @prasadsardeshmukh3898
    @prasadsardeshmukh3898 4 ปีที่แล้ว +1

    One of the best resources for 'Exception Handling in PowerShell'.
    Thanks a lot!

  • @NancyRileyNuniverse
    @NancyRileyNuniverse 3 ปีที่แล้ว +3

    This really is an exceptional video. I have been trying to catch on to how to work with errors and I believe I finally have it!!! Thanks so much - seriously, keep making videos!!!!

  • @Tegle9
    @Tegle9 3 ปีที่แล้ว +4

    This is tremendously helpful. As a student who is used to buying Udemy courses this free course it's the rough equivalent of finding a wallet full of cash on the middle of the road. Great job :)

  • @beku2283
    @beku2283 4 ปีที่แล้ว +5

    Very good flow and clear explanations! Excellent!

  • @vb9950
    @vb9950 ปีที่แล้ว

    6:44 Line number 20. What is the use of semicolon there? is it kind of terminating character for an expression like in c/c++?

  • @vorkpalur
    @vorkpalur 5 ปีที่แล้ว +2

    Thanks a lot for your effort and sharing the knowledge for free!

  • @jordanyefet2679
    @jordanyefet2679 5 ปีที่แล้ว +4

    Very helpful, thank you for your deep and knowledgeable explanations.

  • @amarchougale9471
    @amarchougale9471 ปีที่แล้ว

    Really well explained

  • @BenyBenator
    @BenyBenator 3 ปีที่แล้ว +1

    This is exactly what I needed answers for, and more. You are awesome! Thank you.

  • @robofski
    @robofski 5 ปีที่แล้ว +1

    Excellent series, will you be doing more?

  • @limacal
    @limacal 4 ปีที่แล้ว +2

    Great Explanation! Thank you for the excellent class

  • @ddw1518
    @ddw1518 ปีที่แล้ว

    Hello, techThoughts
    Thank you for your tutorial first.
    I have a question that can we use the powershell to maniplate the website for automatic purpose (like login an user account, and then download something in a webpage).

    • @Techthoughts2
      @Techthoughts2  ปีที่แล้ว

      Yes, check out Selenium: github.com/adamdriscoll/selenium-powershell

  • @pallabba
    @pallabba 4 ปีที่แล้ว +1

    excellent..clearly explained...

  • @juansanchez6685
    @juansanchez6685 ปีที่แล้ว +1

    Great Video!

  • @piggiesgosqueal8066
    @piggiesgosqueal8066 3 ปีที่แล้ว +1

    Thanks! Very useful.

  • @ejhaboc6862
    @ejhaboc6862 2 ปีที่แล้ว

    Hello, I just transferred my script to Powershell version 2 on a windows server, however it is somehow not recognizing the objects Exception.Message from variable $Error, would you be able to advice? Checking on format-list and Get-Member though, it should be listed

  • @bilashshahi
    @bilashshahi 4 ปีที่แล้ว +1

    Thank you so much for this wonderful tutorial :)
    I subscribed

  • @durgapavani3805
    @durgapavani3805 4 ปีที่แล้ว

    Hi, could you tell me how to written error codes

  • @kombatformortals
    @kombatformortals 3 ปีที่แล้ว

    Could some elaborate a bit on why inputting '1/0' changed the array stored as 0?

  • @kishorshevate374
    @kishorshevate374 4 ปีที่แล้ว +2

    Amazing Amazing Amazing... Excellent

  • @Diabloisbackk
    @Diabloisbackk 8 หลายเดือนก่อน

    HOW CAN I FIX THIS ERROR ???
    Windows PowerShell is not properly responding.
    check if it is working, and not locked in Constrained Language Mode.

  • @FapilsonAndrade-rz3wv
    @FapilsonAndrade-rz3wv 4 ปีที่แล้ว +1

    buen tutorial de power shell

  • @AmrXcellent
    @AmrXcellent 2 ปีที่แล้ว

    So good knowledge in general, however I do not recommend changing the -erroraction to stop because as you said, that defeats the entire purpose of Powershell, you don't want your program to stop because of one thing it didnt find.
    Your are better off -ErrorAction SilentlyContinue and then capture that if statement on the object and handle the output based if the object actually returned or not.
    # PowerShell -ErrorAction SilentlyContinue example
    Clear-Host
    $SrvName = "Printer Spooler"
    $Service = Get-Service -display $SrvName -ErrorAction SilentlyContinue
    if (-Not $Service) {$SrvName + " is NOT installed check the name."}
    else {$SrvName + " is installed."
    $SrvName + "'s status is: " + $service.Status }
    which is better because it lets you actually handle the error as you want, if it is a foreach loop, you can do a continue and it will skip the object and go to the next one in the loop.
    Finally, you can set your preference for -ErrorAction by setting this variable in your script (the default is continue - which will give an error on the screen but will continue the script). You can change that to stop or SilentlyContinue.
    $ErrorActionPreference = "SilentlyContinue"

  • @dilatedconciousness
    @dilatedconciousness 8 หลายเดือนก่อน

    Very good

  • @ridewithnarenchand2579
    @ridewithnarenchand2579 3 ปีที่แล้ว

    how to catch errors in CSV if we are checking lst reboot time of remote servers by using:
    Get-CimInstance -classname win32_operatingsystem -property * -computername $servers -ErrorAction Stop | select csname,lastBootupTime,Caption | Out-File $log

  • @ankitsoni9664
    @ankitsoni9664 5 ปีที่แล้ว +1

    hey,
    thanks for creating great videos, they are very easy to understand.
    as far as I have understood the default -erroraction in Continue, but for below code its sop, could you please have a look.
    try{
    $a = 1/0
    $a
    Get-Process
    }
    catch{
    Write-Warning "This is a warning
    "
    }

    • @Techthoughts2
      @Techthoughts2  5 ปีที่แล้ว +2

      When more basic errors (non-cmdlet) like math operations, syntax, and others are wrapped in a try/catch this tells PowerShell to switch the behavior of those errors to stop. It will then go to the catch. Your $a = 1/0 is a math operation error in a try/catch, so the behavior will be stop. If that same operation were outside of the try/catch it would be continue.

  • @anontough6907
    @anontough6907 2 ปีที่แล้ว

    Insane, it was easier to found how to catch and output error on terminal than actually printing the process in the terminal.
    I hate powershell, the docs are garbage.

  • @saeedredrose
    @saeedredrose 4 ปีที่แล้ว +4

    These videos are pure gold. Thank you!