Solved

Powershell: error handling with try and catch

Posted on 2012-04-07
5
1,006 Views
Last Modified: 2012-04-17
Anyone know any good resources for error handling in powershell with try, catch, finally ect.  I cant find any Good detailed resources on the subject.  Im pretty sure there are some.

My usual resources are :
hey scripting guy
PluralSight-Training.Net
Don Jones PowerShell (In a month of Sundays)
Powershell in Action

non that i can find go into detail enough to use.
0
Comment
Question by:resolver1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 20

Assisted Solution

by:BuggyCoder
BuggyCoder earned 100 total points
ID: 37819828
0
 
LVL 70

Accepted Solution

by:
Qlemo earned 400 total points
ID: 37821097
Note regarding the second link: PowerShell 2.0 already has try/catch/finally built-in. trap is hence out-dated, though still useful in some cases.

Additional, up-to-date info is contained in the free eBook Effective Windows PowerShell, p.46ff.

Trap and Error Handling in general is covered again in Mastering PowerShell, Chapter 11 (resp. http://powershell.com/Mastering-PowerShell.pdf, p.326ff).
0
 

Author Closing Comment

by:resolver1
ID: 37827905
Some great free resources. i partilarly like the Mastering PowerShell section on powershell. I use that website but wasnt aware of the free booklet.

Thanks
0
 
LVL 8

Expert Comment

by:Brent Challis
ID: 37854328
if you have installed PowerShell_ISE there is help available that has a section:
about_Try_Catch_Finally, or online at
http://technet.microsoft.com/en-us/library/hh847793.aspx

Which is useful as well.
0
 

Author Comment

by:resolver1
ID: 37854805
Thanks for taking the time to post :-)

I'm not a big fan of microsoft documenation/training on their own products but hey its another resource.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question