Pages

Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training

Thursday, February 2, 2017

__error__ in PowerShell ISE

Wow, I finally got around to doing a little blogging. This has thus far been a very busy year. I’m actually writing this in the air heading
to teach a PowerShell class in North Carolina and prepping my sessions for
PowerShell Summit Europe in a few months.

When I start helping my students debug their issues in
class, I often walk up to their monitors and see the error right away. I am very cautious to point out at the
beginning of class that the reason that I see their errors so fast is because I
have made the same errors so often. Here
is one that left me scratching my head.

While adding a valid parameter to a function that I was
developing, I had this error in the ISE.

I’ll be honest, this was a new one for me. Looking at the message, I realized that there
was a casting of string. This pointed me
to my param block. Sure enough, I placed a comma where I should not have.

You can see it right after [String]. My bad.
Hey, all of us make mistakes.

2 comments:

Hi Jason,I was in your NC class in Morganton. Very informative, really appreciated your time and expertise.

Unfortunately, I left the code for our last day's work on the VM and forgot to copy it to my laptop before class was over. It was the module dealing with writing our own cmdlets/modules using params and scriptblocks with try/catch. I'm working on a project where I could really use that information at work. Do you happen to have your copy of the project that we worked on in class?