Powershell: Get-iQuote
While scratching an itch I found a cool little site that has a simple to use REST api for returning random quotes from multiple categories. Here is a small function which utilizes this online source to pull quotes from the web!
I must have hundreds of these one off scripts laying around in my personal repository collecting dust. I’m trying to get more of these out there as examples (either good or bad!) for others to use in their scripting endeavors. This one is just for fun but has some good examples of; ValidateScript parameter validation, Invoke-WebRequest, Regular Expressions.
One of the more interesting items about this script is that the parameters are actually named exactly as the parameters used in the web request. So all I have to do is parse through the parameters which were passed to the function by key name to build up the web request. This dramatically decreases the overall function size and is a semi-clever hack if I do say so myself.
Keep on scripting my friends!