A Handy Trick I’ve Started to Use a Lot

If you’re like me, you hate to do the same thing over and over.  That’s what programming is for, right?  To handle automating tedious procedures?  Unfortunately, it’s not at all appropriate to run off and build an app every time you need to do the same thing 3 times.  If you try that, you’ll have …

Continue reading ‘A Handy Trick I’ve Started to Use a Lot’ »

Is it just me? (Or does PowerShell remind you of SQL?)

When preparing a PowerShell training class for a group of DBAs, I realized that there were some parallels between basic SQL and basic PowerShell commands. A (very) basic SQL statement has the form: SELECT <COLUMNS> FROM <TABLE> WHERE <CONDITION> ORDER BY <EXPRESSION> I noticed that a very common idiom for PowerShell pipelines* was: <data source …

Continue reading ‘Is it just me? (Or does PowerShell remind you of SQL?)’ »

Executing SQL the Right Way in PowerShell

We all know that using string concatenation (or substitution) in SQL is a “bad thing”.  If you google “SQL Injection”, you’ll find hundreds of pages that tell you not to do things this way and that you need to use parameterized queries.  However, I still see a lot of code in PowerShell that does this: …

Continue reading ‘Executing SQL the Right Way in PowerShell’ »

PowerShell Tools and Books That I Use

Tools I Use (note…these are all free!): PowerGUI Script Editor (I haven’t ever gotten the hang of PowerGUI itself) Powershell Community Extensions 1.2  (PSCX) PowerTab SQL PowerShell Extensions 1.61 (SQLPSX) PrimalForms Community Edition Books: PowerShell In Action by Bruce Payette Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers by  Arul Kumaravel et. al. Mastering …

Continue reading ‘PowerShell Tools and Books That I Use’ »

Getting Scheduled Tasks in PowerShell

There are a few approaches to manipulating scheduled tasks in PowerShell.

* WMI – Useful if you are only going to manipulate them via script. The tasks will not be visible in the control panel applet.
* SCHTASKS.EXE – Works ok, but has a somewhat arcane syntax, and is a text-only tool.
* Task Scheduler API -Best of both worlds, but only on Vista (not XP).

Why PowerShell?

Why am I writing a blog about PowerShell? The answer is simple. I haven’t been as excited about a technology since I first learned SQL. PowerShell allows me to do my job in a much more consistent, flexible, and scalable way.

What is it about PowerShell that has me so fascinated?