I’ve been working a lot lately on our load balancer, a Citrix NetScaler 7500 to be specific. Since we upgraded the to version 10.5 (and got rid of that crappy Java interface) the web experience is actually pretty pleasant and I do most of my work there. If I have a lot of changes I occasionally drop into the CLI, but mostly I’m on the web interface. That said, I love me some PowerShell and I thought wouldn’t it be amazing to have some PowerShell cmdlets? Read on to see how the PSNetScaler module was born.
When I first started dipping my fingers into the GitHub pool, it was because I really felt there was a need. Version control was becoming an issue and having to re-write code I’d already perfected because of a glitch somewhere on the way–translation: accidentally deleting the wrong file–was something that just had to be addressed. And, I think like a lot of PowerShell scripters, I soon started asking questions like: WTF is this? What is going on? Who came up with this crap? I’m no expert, but read on if you’re interested in learning how to use PowerShell and GitHub together.
I’ve been doing a ton of work with SQL and PowerShell over the last year and a half and have come up with some pretty good tools to help me along the way. We even built a module out of them at work and use it in a dozen or more scripts every day, when it finally occurred to me that my readers might like to use them too. And the PS.SQL Module was born.
Saw a fun little challenge from The Ginger Ninja, here. The idea was to use PowerCLI and find out how many unique OS’s you have on your Virtual Center server. Of course, this requires you have a VMware environment, so for the rest of you–sorry!
I’ve been thinking a lot about this lately. What, you ask? How to approach writing a script or advanced function. Most of the time I’ve always in the accommodate world, where I try to imagine every scenario that might happen and account for that in my script. But is this the right approach? Should I instead simply dictate that this is how you use the script? A lot of people do it (VMware requires Connect-VIServer before you do anything). Should I start doing the same?
Awhile back I wrote the Invoke-SQLQuery script, it’s a light-weight easy way to query a SQL database and get data back. It’s primary appeal over just using Invoke-SQLCMD was there is no need to install anything, just run the script, get your data and go. Easy, peesy. Now it’s time for a big update in capability.
I’d been writing PowerShell scripts for a couple of years before I came to athena health, and had a pretty good feel for how I liked to do things. I knew about Transcript logging, but it was so inelegant. Most of the time it didn’t capture much anyway because I really do believe in running clean scripts. A good script shouldn’t have any problems, just run and not really return any feedback. Especially if it’s running as a scheduled task–no one’s there to read it anyway! And that’s the rub, if you’re not there to see what went wrong, how do you troubleshoot it? Logging, of course!
This is a simple report to tell you the status of your SQL Server backups.
This was a fun little script I threw together after a particular conversation came up at Spiceworks. If you’ve worked with PowerShell long you’ve used Get-Content to read a file. 99% of the time, it’s fine and you just continue on with life. This blog post is about that 1% when Get-Content is SLOW. The .NET IO.Streamreader is where people turn to speed things up so I decided to create a function around it that worked much like Get-Content does. This is it’s story.
As I’ve mentioned, I’m doing a ton of SQL work lately (more on that later!) and I just had a co-worker ask for something so I threw together this quick query. One of our backups had failed and he just wanted to know where the backup file was being placed (in most cases we backup locally but we do have some exceptions). I threw together this query to locate the file name:
I also have a new PowerShell script that reports on SQL backups that I want to get published, as well as a more intelligent index rebuilder that is Availability Group and log shipping aware.