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?
As a follow-up to the ConvertTo-AdvHTML function, I have also written a much simpler version that simply changes the color of a cell. The advantage to this script over the bigger ConvertTo-AdvHTML function is it works with current ConvertTo-HTML, or even HTML pages from other sources. It also allows you the ability to set the criteria for the the color change. Best of all it’s simple to use.
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.
This has come up a couple of times and I’ve always managed to work around it, but there will come a time when you want to create an advanced function or script. One with many parameters, and some of those parameters will be mutually exclusive. You can do this using the ParameterSetName argument, inside the Parameter decorator. Here’s how!
The other day I mentioned I was having a really bad day–that after being recognized turned into a really good day. The reason it was though was because my shiny new firewall from Meraki was having all kinds of problems keeping a reliable site-to-site VPN with my co-host site. The remote firewall was a Cisco ASA 5510 so you would have thought this wouldn’t be a problem! But it was, and from it arose a need to create something that could monitor if my multiple subnets were routing properly. The funny thing was I had recently helped another Spicehead with a similar script! Now I needed it!
Had a great time creating the Out-LastEarthquake.ps1 script, but let’s face it, other than it’s cool factor it doesn’t have much use. But what we do have is the framework for the ability to place markers on a Google Map, and there are definitely some uses for that. I created a proof of concept script that shows just what you could do.
You know, it’s funny how projects sometimes grow from something very small and become something quite different. This is a story about exactly that.
Another script came through on Spiceworks here, and I liked the idea of it. Not to mention I thought I could improve on it a bit using PowerShell. It was also a good excuse to practice using Invoke-WebRequest which I haven’t had a lot of projects that use it!
Like a lot of administrators I work on a couple of different PC’s, and keeping my PowerShell profile the same on each machine is a bit of a pain. I decided it was time to do something about that! With these changes I can easily add to my profile and have that change happen on every PC I use!