Got a couple of new scripts I recently wrote, here’s some quick thoughts on them.
Really fascinating project came through Spiceworks the other day and I wanted to talk about it. In the DNS forum someone posted that they needed a tool to lookup certain WhoIs information. The interesting part was they had over 1000 domains so they needed something that could create a report on that kind of scale, so a simple WhoIs website or application wasn’t going to cut it. But as I looked at it, I began to wonder if this was something I could pull off with PowerShell? I knew there would be no problem once I had the data, but the trick would be getting the data. But surely there was a RESTful API out there for WhoIs data, right? If I could find that then a simple Invoke-RestMethod should retrieve the data necessary and we’re good to go. Right?
I love using ConvertTo-HTML. There, I’ve said it. The vast number of scripts I write are doing some kind of reporting function and the ability to create simple, fast, yet good looking reports with HTML has been a huge plus for PowerShell. That said though, there’s definitely room for improvement. ConvertTo-AdvHTML is an advanced function that addresses some of the current limitations with current cmdlet. But this blog post isn’t going to a long explanation of how to use the new cmdlet, instead I wanted to write a script that actually used it.
Find yourself creating reports in Powershell and wished they looked a little more presentable than a CSV file? Send regular reports to your manager and want it to look professional? Here are some technique’s I’ve developed that produce some pretty sharp reports in HTML using standard Powershell cmdlets (plus one function to pretty up your tables).
A little while back the Microsoft Scripting Guy, Ed Wilson, blogged about creating a simple web page with server uptime. It was an interesting use of some of the Powershell capabilities and the output was pretty good, if a little uninspiring–not his fault I might add, more a limitation of the Powershell tools he was trying to use. I didn’t do anything about the script at the time, but it always intrigued me. Then the other day a very similar request came across on Spiceworks. At first I just gave the guy the same link I put above, but now the bug was in my ear and I decided to write something up.