Showing archive results for 2010

Mar 13, 2010
Post comments count0
Post likes count0

Hey, Scripting Guy! Weekend Scripter: Accessing Environmental Variables

ScriptingGuy1

 Microsoft Scripting Guy Ed Wilson here. I spent the day at SQL Saturday in Charlotte, NC. I could not resist the opportunity to network with that many rabid Windows PowerShell addicts. I mean, anyone who gives up their Saturday to come to a Microsoft office and sit in training sessions all day is dedicated. Definitely my type of geek. It was ...

Scripting Guy!Windows PowerShellWeekend Scripter
Mar 11, 2010
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Use Try/Catch/Finally in Windows PowerShell?

ScriptingGuy1

  Hey, Scripting Guy! One thing I miss in Windows PowerShell is the ability to use a Try/Catch/Finally block that I can use in C#. To me it is an elegant solution to error handling. You attempt something, catch any resulting errors, and clean up the mess you made. Are there any plans in Windows PowerShell 3.0 to introduce this kind of str...

Scripting Guy!Windows PowerShellscripting techniques
Mar 10, 2010
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Use the Test-Path Cmdlet to Check for Resources?

ScriptingGuy1

  Hey, Scripting Guy! Ignoring errors or bubbling up errors to the user of a script seems a bit inefficient. I mean, wouldn’t it be better to avoid the errors in the first place? I am only a beginner when it comes to writing scripts, and maybe I just do not get it, but why can’t you just write code that does not generate errors?-- ...

Scripting Guy!Windows PowerShellscripting techniques
Mar 9, 2010
Post comments count0
Post likes count0

Hey, Scripting Guy! How Can I Use the –ErrorAction Preference Parameter?

ScriptingGuy1

  Hey, Scripting Guy! I enjoyed reading your blog post yesterday about using $ErrorActionPreference to control the behavior of a script. One thing I never liked about using “On Error Resume Next” from VBScript was that it seemed to be an all-or-nothing type of proposition. There are certain errors I do not need to see, but the...

Scripting Guy!Windows PowerShellscripting techniques
Mar 8, 2010
Post comments count0
Post likes count1

Hey, Scripting Guy! How Can I Use $ErrorActionPreference to Control Cmdlet Handling of Errors?

ScriptingGuy1

   Hey, Scripting Guy! One thing I liked about using VBScript is that I could add On Error Resume Next to the top of a script, and all my problems with the script went away. It was like magic, and I used it to fix many of my scripts. I really miss this capability in Windows PowerShell. -- MW Hello MW, Microsoft Scripting Guy Ed Wilso...

Scripting Guy!Windows PowerShellscripting techniques