tag:blogger.com,1999:blog-8229131257128040189.post6443273472908210667..comments2023-04-11T11:36:03.057+01:00Comments on Think Big - with Powershell: Useful Script functions - ScriptingTompahttp://www.blogger.com/profile/00462564333522996562noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-8229131257128040189.post-16819007735999357882014-01-12T13:23:21.448+00:002014-01-12T13:23:21.448+00:00If you have a terminating error, e.g. the .net obj...If you have a terminating error, e.g. the .net object (System.Net.Networkinformation.Ping) throws an unhandled exception or even a handled one which is a terminating error, it terminates the whole PS session, so your script will not continue. That line traps the error and as the trap has a 'Continue' command in there, the function will simply contiue doing its job.<br /><br />If you use the PingServer function against 100+ servers, you really want the full list to be pinged instead of seeing your script terminate on the first unpinagle on the list, that's why the trap is there.<br /><br />to read more, run this in PS:<br />PS C:\> man about_trap<br /><br />tTompahttps://www.blogger.com/profile/00462564333522996562noreply@blogger.comtag:blogger.com,1999:blog-8229131257128040189.post-31761317317440762152014-01-03T13:23:47.313+00:002014-01-03T13:23:47.313+00:00What does the Trap line do in the ping function? G...What does the Trap line do in the ping function? Great collection, thanks, Master tompa.Danielhttps://www.blogger.com/profile/13110131518974636247noreply@blogger.com