Caffeinated Coder

A Grande, Triple Shot, Non-Fat Core Dump by Russell Ball

Browsing Posts in Powershell

Whenever I review PowerShell scripts, I usually consider loops (especially nested ones) to be a code smell. It usually indicates to me that script is unnecessarily procedural and could benefit from being rewritten in a more functional manner. Take this simple code snippet as an example. It searches sql files for a particular string (the [...]

If you work with PowerShell and don’t already have PowerTab installed, take a few minutes to download and install it now. It’s a painless setup, especially if you just keep hitting enter at the prompts to accept the defaults, and the ansi-art intellisense magic just starts working everywhere without you having to learn anything. If [...]

If you decide to run a marathon, one of the first things you have to do is choose a training program. Training programs prescribe incremental steps that you’ll need to take in order to attain your goal. In running, this usually involves gradually increasing your weekly mileage and long distance runs for several months before the [...]

One of my goals for the next six months was to contribute to an open source project and I think I’ve chosen one. I downloaded and installed the PowerShell Community Extensions (a.k.a. pscx) from codeplex a while ago, but I just now got around to really tinkering with the cmdLets and reviewing the source code and scripts. I have to say [...]

Anything that can be done with ADO.NET is possible in PowerShell through a call to Assembly::Load and the New-Object cmdLet, but that doesn’t mean that the resulting code will seem very shell-like or practical. Two approaches to database access that definitely do seem compelling to me, however, are the sample SQL Provider recently demoed by the PowerShell team and Dan Sullivan’s PowerSMO script, which is really just a [...]

The more I work with powershell, the more I start seeing everything that lives on the computer as part of a giant database that I can query. When used in conjunction with the pipeline and get-member -type property to discover the available properties on an object, the where-object, sort-object, select-object, and group-object cmdlets can be strung together [...]

I’m doing some work now on an internal web application where I had to logon with an external test account before I could do anything. That got old fast, so I created a powershell script file to automatically launch IE, input the username and password, and click the submit button. I originally tried to do this with WatiN, [...]

Here is a good joke to play on one of your developer buddies if they have powershell and SQL Server installed on their local machines and you have sa rights on the SQL Server for whatever reason (former debugging help, open environment between developers, blank sa password, or mad hacker skills on your part). Wait [...]

I’ve been impressed by the attention paid to discoverabiltiy in powershell, which has allowed me to quite a bit of learning without ever leaving the command line. Here are a few of my favorite features: Guessing - This may seem strange to list as the number one discoverability feature, but I think the Powershell design team did an [...]

I’ve been spelunking Powershell lately with Bruce Payette’s excellent book, Powershell in Action, and thought I would take a step back from some of the lower level nuances, such as dynamic type conversion and parameter binding rules, and organize my thoughts at a higher level. What is Powershell? - It is the new command line/scripting environment from [...]