PowerShell Script for Creating Indexes

PowerShell, SQL Server, T-SQL
I needed to create an identical index on a bunch of tables within one of my projects (yes, I know this is problematic on multiple levels and I'm working on that too). Rather than sitting around typing this up, I decided to use PowerShell to do the work for me. I'm still very much learning how to do things in PowerShell so this took me almost as long as it would have to type them up, but now I know more than I did. Having gone through the pain of trying to find a good example on the web that did exactly what I wanted (they're out there, just hard to find), I decided I'd add this one in so the next person had at least one more source of…
Read More

More PowerShell Basics

PowerShell
Because of the data center move, we have a number of different functions that we're running on totally different sets of servers on different days. None of this is part of our normal maintenance routines, so I've been using it as a great opportunity to stretch a little with PowerShell. I'm still learning, a lot. The latest task was to get the databases of a list of servers backed up. I initially tried it using SMO. It works great. But it's serial across all the servers as well as across the databases. I'm fine with serial backups on the databases (very, very fine, I saw a parallel backup of all databases once, pretty sparks, like the Fourth of July) but I really wanted all the servers to get backed up…
Read More

PowerShell Basics

PowerShell
I'm just learning how to use PowerShell. I've been trying to spend time with it over the last year, ever since I saw Allen White's presentations at the PASS Summit last year. I just haven't had the time. But recently, my company has been performing a multi-phased data center move. Because of it, I've needed to run tests & updates, disable jobs, all kinds of things on different sets of servers on different days. To paraphrase the old Superman cartoons "This looks like a job <voice gets deeper> for PowerShell." I'm not even remotely qualified to begin teaching anyone PowerShell. I had problems recently getting an IF conditional statement to work correctly. However, in the interest of sharing, in case you're thinking about picking it up (do) or you're actively…
Read More

SCOM VBScript Testing: The Answer

Tools
It took a while, but I finally tracked down the information I needed. SCOM has an SDK. In the SDK is a nice little page showing how to test & debug scripts. One of the links on that page leads out here to a great article on the VBScript debugger. That's what I needed (along with the DLL's to register). Anyway, I've almost got my first monitoring script up & running. I'll post it on here once I do.
Read More