Solved

Powershell: error handling with try and catch

Posted on 2012-04-07
5
1,000 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
Comment Utility
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 400 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
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…

744 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

16 Experts available now in Live!

Get 1:1 Help Now