Automating Quote Of The Day In Email Signature Using PowerShell

Automating the Outlook signature involves many things from gathering information from AD to environmental variable and so on.

We have seen people using inspirational quotes at the bottom of their signature and periodically they change the quotes.

How about using a new quote every day in your signature and that being automated using PowerShell?

This blog is about the automation of quotes into an email signature.

I am getting quotes from http://www.eduro.com/ (Thanks to Eduro).

Full Script Link

Core Script 

  1. $AppData=$env:appdata  
  2. $SigPath = ‘\Microsoft\Signatures’  
  3. $LocalSignaturePath = $AppData+$SigPath  

The signature information will be available in C:\Users\<username> \AppData\Roaming\Microsoft\Signatures

  1. if (!(Test - path“ $LocalSignaturePath\ signaturecustom.txt”)) {  
  2.     @”  
  3.     First and Last Name  
  4.     Title | Group  
  5.     CompanyName | Direct phone | Mobile phone | firstname.lastname @company.com“ @ | out - file“ $LocalSignaturePath\ signaturecustom.txt”  
  6. }  

It will create a text file in the C:\Users\<username> \AppData\Roaming\Microsoft\Signatures\signaturecustom.txt for the first time. This file needs to be changed as per the user data.

Here comes the web scrapping.

  1. $url = “http: //www.eduro.com/”;  
  2.     $r1 = Invoke - WebRequest - Uri $url  
  3. $r4 = @ {}  
  4. $r2 = ($r1.ParsedHtml.getElementsByTagName(‘p’))[0]  
  5. $r4[1] = $r2.innerText  
  6. $r3 = ($r1.ParsedHtml.getElementsByTagName(‘p’))[1]  
  7. $r4[0] = $r3.innerText  
 

NoteThe text of the signaturecustom.txt file needs to be modified as per your signature.

Once the signature custom template is selected from the signature ribbon button in Outlook, it will display the output like this.

 
 

Lastly, you can schedule it in Task Scheduler.