2 comments

  1. Nice! Really fast on my laptop! I like how it catches the errors gracefully. A bit against the best practices that huge “try{}catch{}” block, but why follow these guidlines if it is only to be a *$¨!# in the but!? (I actually know the answer: It is to have a more precise error handeling, and specifically, to be able to use the finally{} scriptblock).

    I personally like to add a “Get-Credential” right after my credential variable when I use it. (But it will make it mandatory).
    [System.Management.Automation.Credential()] $Credential = (Get-credential)

    Great work!

    Like

  2. Thanks. Yeah, I tend to use large try-catch blocks. For me it’s enough that I catch any exceptions. If I’m working on a really complicated script, I’ll do it differently of course, but these functions are really just meant to do small things, so it works well I think.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s