Solved

Powershell: error handling with try and catch

Posted on 2012-04-07
5
1,007 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

691 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