Skip to content

Instantly share code, notes, and snippets.

Last active Feb 3, 2017
What would you like to do?
$Rewards = "Donuts","Cookies","Steak","Bacon","Cupcakes","Truffles","Chocolates","Snacks","Breakfast","Lunch","Back rubs","Burgers","Pancakes","High fives","Coconuts","Cheesecake","Stamps"
$sendDateTime = (Get-Date)
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 = ";"
$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
$sendDateTime = (Get-Date).AddDays(1)
Write-Output "Next send scheduled for: " + $sendDateTime
Start-Sleep -s 60
#With Love,
#update $url if the script changes
$url = '';
$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