Solved

Powershell: error handling with try and catch

Posted on 2012-04-07
5
1,001 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
5 Comments
 
LVL 20

Assisted Solution

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

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:bchallis
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now