Error checking in PowerShell
Tuesday, October 2nd, 2007I recently thought I ought to lift my scripting game and introduce some error checking into my PowerShell scripts.
After a quick google I found this excellent article from the Scripting Guys.
In essence, we set:
$error.clear()
$erroractionpreference = "SilentlyContinue"
And then use, the following statement to test whether the last command was successful:
if (!$?)
{
"An error has occurred."
}
If you just [...]
Windows Script 5.7 Released!
Friday, August 10th, 2007I didn’t see this one coming.
Microsoft have released 5.7 of Windows Script. This provides an update for:
Microsoft® Windows® Script containing Visual Basic® Script Edition (VBScript.) Version 5.7, JScript® Version 5.7, Windows Script Components, Windows Script Host 5.7, and Windows Script Runtime Version 5.7.
Get your downloads here:
Windows 2000
Windows XP
Windows Server 2003
Utilising CMD behaviour in PowerShell
Thursday, May 24th, 2007A couple of days ago Jeffrey Snover posted this article on the Windows PowerShell Team blog. I had noted this behaviour previously and just put it down to a quirk of PowerShell.
So I’ve been musing over what I miss from the CMD that I’d like available in PoSh. To help jog my memory I fired [...]