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.
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.
If you’re looking to read about Modules and what they are and how to make them, this isn’t the blog post for you. No, the problem I have is living with Modules. I’ve only recently begun using them with the new job, but they have quickly made a place in my heart because being able to just call a module over and reuse code saves so much time! But, as always happens, I want to make a change or fix a bug and that’s where modules fall on their face (a little). This is my attempt to address that fact.
There are a whole bunch of blog posts and scripts out there to do SQL queries in PowerShell, so I’ve really hesitated about posting my own version of it. But hey, it’s my blog and I can do what I want to. Do what I want to.
Recently I’ve been doing more with Powershell functions, and blissfully telling people to run the script and then the function is available to you. This is great if you use a Powershell ISE, either the built in one or a third-party one like PowerGUI. ISE’s will keep functions alive after you’ve run your script, which is a great feature while you’re testing a new script. The shell, on the other hand, isn’t so forgiving. Run it there and it loads into memory and as soon as the script finishes it promptly is DUMPED from memory.
Oops, sorry about that!