sysadmin Convert Coffee Into Code

Published on January 28th, 2014 | by Kalen Wessel

3

Converting Caffeine into Code

There is no denying that if you’re working as a developer, systems admin, engineer, or in sales you need that omnipotent drug best known as caffeine. It doesn’t matter if you are a americano, espresso, or straight coffee lover – you just need that fix. A group of colleagues I work with religiously make an effort to take some time to step outside of the office and enjoy the warm friendly environment of Caffè Artigiano.

As a person whose job is to automate as many processes as possible it only seemed fit that I streamline the 11 o’clock coffee rendezvous. Since the actual script isn’t all that exciting I wanted to add something that would up the “wow” factor. I just recently picked up a new keyboard for the office and something that’s great about Cherry MX mechanical keyboards is the ability to swap out the kepcaps. The next move was obvious – purchase a function key that had a coffee mug on it. So now anytime I press the ‘coffee’ key an email is sent out to my coworkers letting them know to finish up whatever they are in the middle of and head out.

Coffee Key

If this is your first time running a Powershell script you will need to change the policy on running unsigned scripts. Open Powershell with administrative privileges and execute the following command:

Set-ExecutionPolicy RemoteSigned

By setting the policy to RemoteSigned; Scripts created locally will run, but those downloaded from the Internet will not.

# Hotkey Coffee Invite Script
 
Start-Process Outlook
 
$o = New-Object -com Outlook.Application
 
$mail = $o.CreateItem(0)
$mail.subject = "Coffee in 10 @ Artigiano's"
$mail.body = "Don't be late."
$mail.body = ""
$mail.To = "luke@email.com; derek@email.com"
$mail.Send()
 
write-host "Message Sent"

Sometimes even the simplest ideas can be the most practical (and fun). Maybe CoffeeScript v2 will incorporate some more functionality like randomly selecting which coffee each of us will indulge in.

Get-Random -input "Americano","Espresso","Double Shot"

Keep those coffee pots brewing and lines of code flowing! And if you have any suggestions for a coffee script please let me know in the comments.

Tags: , , ,


About the Author

is a multidisciplinary systems administrator. Whether it's auditing network security, implementing scale-able systems, or providing technical services - he makes it his focus to perform due diligence on all his tasks.



3 Responses to Converting Caffeine into Code

  1. Carl says:

    Nice article brochacho (srs).

  2. Chris says:

    From a security standpoint you’re better off setting Powershell’s execution policy to RemoteSigned. Is there any reason you’re dropping it to Unrestricted? #badpractice

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current ye@r *

Back to Top ↑