Last active
February 3, 2017 20:38
-
-
Save joshjordan/efe79ca3a15900e3f3efed4efee351a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Rewards = "Donuts","Cookies","Steak","Bacon","Cupcakes","Truffles","Chocolates","Snacks","Breakfast","Lunch","Back rubs","Burgers","Pancakes","High fives","Coconuts","Cheesecake","Stamps" | |
$sendDateTime = (Get-Date) | |
$sendDateTime.AddSeconds(-1) | |
while($true) | |
{ | |
Write-Output ($sendDateTime -lt (Get-Date)) | |
if($sendDateTime -lt (Get-Date)) | |
{ | |
$ChosenReward = $Rewards | Get-Random | |
$Outlook = New-Object -ComObject Outlook.Application | |
$Mail = $Outlook.CreateItem(0) | |
$Mail.To = "[email protected];[email protected]" | |
$Mail.Subject = "Free " + $ChosenReward + " Tomorrow!" | |
$Mail.Body = $ChosenReward + " will be available in the open area near us tomorrow, courtesy of yours truly! Unrelatedly, don't leave your computer unlocked." | |
Write-Output "Sending mail:" | |
Write-Output $Mail | |
$Mail.Send() | |
$sendDateTime = (Get-Date).AddDays(1) | |
Write-Output "Next send scheduled for: " + $sendDateTime | |
} | |
Start-Sleep -s 60 | |
} | |
#With Love, | |
#jjordan |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#update $url if the script changes | |
$url = 'https://gist.githubusercontent.com/joshjordan/efe79ca3a15900e3f3efed4efee351a7/raw/915ad077b1659acdbf8efdaab53d1959777a2021/donuts.ps1'; | |
$file = 'donuts.ps1'; | |
Invoke-WebRequest -Uri $url -OutFile $file | |
Invoke-Expression -Command ".\donuts.ps1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment