Getting Excuses Automatically

by Nov 11, 2013

Tired of inventing lame excuses yourself? Then here's a script that gets you a new excuse any time you call Get-Excuse! All you need is Internet access:

function Get-Excuse
  $url = ''
  $ProgressPreference = 'SilentlyContinue'
  $page = Invoke-WebRequest -Uri $url -UseBasicParsing
  $pattern = '<br><font size = "\+2">(.+)'

  if ($page.Content -match $pattern)

If your Internet access goes through a proxy or needs authentication, then look at the parameters of Invoke-WebRequest inside the function. You can submit proxy information as well as credentials.

Twitter This Tip! ReTweet this Tip!