Your SlideShare is downloading. ×
Adv PowerShell error handling, debugging, and cmdlets
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Adv PowerShell error handling, debugging, and cmdlets

1,145
views

Published on

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,145
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Advanced Windows PowerShellError Handling, Debugging, “Script Cmdlets,” and More
    Don Jones
    Concentrated Technology
    http://ConcentratedTech.com
  • 2. This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own organization however you like.
    For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site, www.ConcentratedTech.com.
    For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg
    This work is copyright ©Concentrated Technology, LLC
  • 3. Agenda
    Crazy amounts of demo, very little slide
    Shell transcript and samples will be downloadable from ConcentratedTech.com by next week
    Error Handling
    Debugging Techniques
    “Script Cmdlets” (Advanced Functions)
    Tips along the way
  • 4. Errors in PowerShell
    Non-terminating errors take the behavior in $ErrorActionPreference
    Must make terminating to trap/handle
    Use the –ErrorAction (-EA) parameter
    Use –ErrorVariable (-EV) to capture the error in a variable
    Use Try…Catch to actually catch the error
  • 5. Debugging
    Write-Debug to write trace code
    Write-Verbose to write “progress” info
    $DebugPreference, $VerbosePreference
    -debug and –verbose for scripts
    Also: PSBreakpoints
  • 6. Advanced Functions
    A function that looks and works and smells like a “real” cmdlet
    Mainly just decorating function parameters and adding comment-based help
    Couple of cool tricks to support –confirm and –whatif
    Accept both pipeline and parameter input
    Let’s make one
  • 7. Pretty cool stuff, eh?
    Again – shell transcript/samples will be on ConcentratedTech.com by next week
  • 8. Final Q&A
    Text DONJ to 50500 for contact info
    See me for add’l resources
    Books
    Workshop recordings
    Demo videos
    Etc
    Slide decks posted to ConcentratedTech.com by next week
  • 9. Your Feedback is Important
    Please fill out a session evaluation form drop it off at the conference registration desk.
    Thank you!
  • 10. This slide deck was used in one of our many conference presentations. We hope you enjoy it, and invite you to use it within your own organization however you like.
    For more information on our company, including information on private classes and upcoming conference appearances, please visit our Web site, www.ConcentratedTech.com.
    For links to newly-posted decks, follow us on Twitter:@concentrateddon or @concentratdgreg
    This work is copyright ©Concentrated Technology, LLC

×