Jump to content
EduGeek EdSec 2026 is on Tuesday in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted
Setting a global signature in o365 requires HTML coding. Anyone know of a good free signature generator that will allow you to copy and paste the HTML code afterwards?
Posted (edited)

I spent a bit of time on this but kept it simple, here is the script i used.

#import the active directory module which is needed for Get-ADUser

import-module activedirectory

 

#set folder location for files, the folder must already exist

$save_location = 'c:\file_location_test\'

 

#$users = Get-ADUser -filter * -searchbase "OU=Testing,OU=Staff,OU=Test Users,DC=bigcheese,DC=com" -Properties * -Credential bigcheese\admin -Server bigcheese.com

$users = Get-ADUser -filter * -searchbase "OU=dropbox user,OU=Staff,OU=User Accounts,OU=CTK,DC=internal,DC=LOCAL" -Properties *

 

foreach ($user in $users) {

$full_name = “$($user.DisplayName)”

$account_name = "$($User.sAMAccountName)"

$job_title = "$($User.title)"

$logo = "$($User.wWWHomePage)"

 

#We need to construct and write the html signature file

$output_file = $save_location + $account_name + ".htm"

Write-Host "Now attempting to create signature html file for " $full_name

"" + $full_name + "

", $job_title, "

" + "

" + "" +"SCHOOL NAME" + "" + "

" + "" + "Road, Suburb, City, Postcode" + "" + "

" + "" + "T " +"" +"" + "" +"01772 252072 " + "" + "" + "" + "W " + "" + ""+ "" + "www.something.sch.uk" + "

" +"Like us on Facebook" + " " + "Follow us on Twitter" | Out-File $output_file

}

 

i then used this script to send it to office 365.

 

set folder location for files, the folder must allready exist

$save_location = 'c:\file_location_test\'

$email_domain = '@domain.sch.uk'

 

#connect to O365 tenant

$Cred = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection

Import-PSSession $Session

 

#Get a list of all the filenames in the target folder

$sig_files = Get-ChildItem -Path $save_location

 

#Now push the html to the users signature

foreach ($item in $sig_files) {

 

$user_name = $($item.Basename) + $email_domain

$filename = $save_location + $($item.Basename) + ".htm"

 

Write-Host "Now attempting to set signature for " $user_name

set-mailboxmessageconfiguration -identity $user_name -signaturehtml (get-content $filename) -autoaddsignature $true

}

 

#disconnect O365 connection

get-PSSession | remove-PSSession

Edited by LukeC
  • Thanks 2
Posted
I'm currently adding html code to the disclaimer in the exchange online rules. It allows copy & paste of code but looking for a sig generator so i can avoid the bulk of the programming and just modify the code with %%fields%%

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...