I’m often training administrators to use Windows PowerShell or offering guidance in a number of forums. As you might imagine I see a lot of code samples. Of course I help with the immediate challenge, but often I see opportunities where a few slight tweaks to the code layout can make a difference in readability and troubleshooting. Here’s what I’m talking about.
Category: Windows PowerShell
Updated Windows PowerShell:TFM 3rd edition now available
At long last, we’ve released an updated version of Windows PowerShell: TFM 3rd Ed that covers PowerShell CTP 3. Actually, you’ll find some overlap with the version of PowerShell included in WIndows 7 RC1. This version of the book is offered in eBook format as part of our IPO program.
ChangeVue to get PowerShell cmdlet interface
ChangeVue 2009, SAPIEN Technologies’ source control system, is about to get a new way to manage its content: a PowerShell snap-in! That’s right. You will soon be able to manage your existing ChangeVue repositories directly through the PowerShell console or through a PowerShell script. Simply install the ChangeVue snap-in using the PowerShell cmdlet “Add-PSSnapin -name […]
June ’09 PowerShell One-Liner
In case you don’t get the SAPIEN Newsletter, here’s my PowerShell one-liner for the month that uses Get-Command to find scripts in your path.
PowerShell Functions: Return vs Write
The other day I was involved in a short Twitter debate about the relative merits of using RETURN vs Write-Object (or its alias Write) in PowerShell functions. Here’s my take.
Updated PowerShell TreeForm
Not too long ago I wrote a blog post about a Windows Form PowerShell script to display a folder tree. I got some feedback about an error when running the script. The problem was that I was casting a variable in one of the functions to a specific type. Normally this is considered a best practice. But in this situation the [System.Windows.Forms.TreeNode] class depends on the parent class being loaded in your PowerShell session. Even though I thought I had tested thoroughly on PowerShell v1 and v2 I must have missed something and the [System.WIndows.Forms] class was getting loaded into my shell prior to running the script, which is why I never saw the error. Anyway, I’ve since modified the problematic function to remove the type casting.
It slices, it dices, and it makes forms!
Some of you may be familiar with our community version of PrimalForms (available on http://www.primaltools.com). If you are ready to take your PowerShell forms to the next level or want to add forms to your PowerShell scripts for the first time, then PrimalForms 2009 is for you. But wait! Some of you may ask: I […]
Creating XML Configuration Files the PowerShell Way.
Several weeks ago I posted an entry on creating configuration files. This same technique can also work with XML files. I’m still working on a more advanced technique but wanted to share this simpler approach.
Good, Better, Best
I’m very happy to see more and more people getting their hands dirty with Windows PowerShell. A common challenge I see across different support forums is getting information from one part of a script to another. Very often the user has created a function and is attempting to use its output elsewhere in their script. Often I can tell the scripter is coming from a VBScript background or at least thinking that way. There’s nothing necessarily wrong with writing a PowerShell script in a VBScript style, but these scripts are missing out. Let me walk you through several iterations of a function to demonstrate.
PowerShell Special Forces Invades Columbus, Ohio
Are you ready Ohio? We’re bringing our intense, one-of-a-kind Special Forces PowerShell training to Columbus, Ohio July 27-29, 2009. We’re looking for up to 15 recruits who want to learn PowerShell from the ground up and aren’t afraid to get their hands duty. This is unlike any other training course you’ve ever taken. Not everyone can meet the requirements, but those that do learn more PowerShell than they realized was possible in three days. But wait..there’s more!