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 = 'http://pages.cs.wisc.edu/~ballard/bofh/bofhserver.pl'
- $ProgressPreference = 'SilentlyContinue'
- $page = Invoke-WebRequest -Uri $url -UseBasicParsing
- $pattern = '<br><font size = "\+2">(.+)'
-
- if ($page.Content -match $pattern)
- {
- $matches[1]
- }
- }
复制代码 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.
http://powershell.com/cs/blogs/tips/archive/2013/11/11/getting-excuses-automatically.aspx |