How to create Email signature based on specific template for each people in certain OU ?

Hi All,

Can anyone here please share some tips or steps in Group Policy in how to create the Outlook Email signature for each people in different OU ?

For Example:

Domain.com/Users/Accounting --> Email Signature Template ACC1.
Domain.com/Users/IT --> Email Signature Template IT1.
Domain.com/Users/Marketing --> Email Signature Template MRK1.

How to do that based on each OU ?

Note, the users are using various different OS and Office product like:
Operating System: Windows 7 and Windows 10
MS Office: 2010, 2013 and 2016 (some will use 64 bit, but majority is 32 bit)

Any help and guidance will be greatly appreciated,

Thanks,
LVL 13
Senior IT System EngineerSenior Systems EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AntzsInfrastructure ServicesCommented:
If your signature only contain text, you can use the mail flows rules in Exchange and set the respective signatures.

But, if you need to insert picture in your signature.  The only way is to use those email signature software such as the below.

https://www.exclaimer.com
https://www.codetwo.com/
Senior IT System EngineerSenior Systems EngineerAuthor Commented:
No, I don't want to buy any software.
I just need the script and the group policy settings.
AntzsInfrastructure ServicesCommented:
I was also looking at some script and GPO to accomplish this last year.  But all I got was that this is not supported.  

Software is the only way this will work if picture are involved.
Get Blueprints for Increased Customer Retention

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

yo_beeDirector of Information TechnologyCommented:
here is a sample and not exactly what you are looking for, but it is a start  
script you can modify

clear
Import-Module ActiveDirectory 
$attrs = Import-Csv -Path C:\users\xxxxx\Downloads\summers.csv | %{Get-ADUser -Identity $_.samaccountname -Properties attrs = Get-ADUser -Identity joe -Properties * 
#$i = xxxxx 
foreach ( $attr in $attrs)
{

#$i = $i + xxxxx

#$filename = $attr.Sn + ', ' + $attr.GivenName
$filename = 'xxxxx Partners LLP'
#$filePath = "C:\Users\xxxxx\Downloads\Signture\" + $filename
$filepath = '\\netappxxxxxxxxxx\UserData\Profile\' + $attr.SamAccountName + '\UPM_Profile\AppData\Roaming\Microsoft\Signatures'
#$openfile = $filePath +'\'+ $filename +'.docx'

If(-not(Test-path -Path $filePath))
    { New-Item $filePath -type Directory}
    Else
    {"Directory already exist"}
 
#[ref]$SaveFormat = "microsoft.office.interop.word.WdSaveFormat" -as [type]
$word = New-Object -ComObject word.application
$word.visible = $false
$doc = $word.documents.add()

$selection = $word.selection
#$selection.WholeStory
$selection.Style = "No Spacing"


$selection.font.size = xxxxxxxxxx
$selection.font.name = 'Arial'
$selection.font.bold = xxxxx
$selection.typeText($attr.GivenName + ' ' + $attr.sn )
$selection.TypeParagraph()
$selection.TypeText($attr.title)

$selection.TypeParagraph()
$selection.TypeParagraph()
$selection.font.bold = xxxxx
$selection.font.size = xxxxxxxxxx
$selection.typeText("xxxxx Partners LLP")


$selection.TypeParagraph()
$selection.font.bold = xxxxx
$selection.font.size = xxxxxxxxxx
$selection.typeText($attr.StreetAddress)

$selection.TypeParagraph()
$selection.typeText($attr.City +  ', ' + $attr.State + ' ' + $attr.PostalCode)
$selection.TypeParagraph()
Switch ($attr.state) 
    {
      'NY'{$selection.TypeText('+xxxxx xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx Main')}
      'DC'{$selection.TypeText('+xxxxx xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx Main')}
      'MA'{$selection.typetext('+xxxxx xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx Main')}
    }
#If ($attr.state -eq 'NY')
#{
#$selection.TypeText('+xxxxx xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx Main')
#} 
#ElseIF ($attr.state = 'DC')
#{
#$selection.TypeText('+xxxxx xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx Main')
#}
#Elseif ($attr.state = 'MA')
#{
#$selection.typetext('+xxxxx xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxx.xxxxxxxxxxxxxxxxxxxx Main')
#}
$selection.TypeParagraph()
$selection.TypeText('+xxxxx ' + $attr.telephoneNumber.Replace('-','.') + ' Direct')
$selection.TypeParagraph()
$selection.TypeParagraph()
$email = $attr.mail

$selection.typetext($email)
$selection.TypeParagraph()
$selection.TypeText('www.xxxxxpartners.com')
#$selection.inlineShapes.AddPicture("C:\Users\xxxxx\Pictures\Test.jpg")



#Start-Sleep -s xxxxx
#$doc.saveas([ref] $openFILE)
#$doc.close()
#$word.Quit()
#$openfile
#Start-Sleep -s xxxxx
#$word = New-Object -ComObject word.application
#$word.visible = $true
#$word.Documents.open($openfile)

#$openfile = $filePath +'\'+ $filename + '.RTF'
$openfile = $filePath+'\'+$filename +'.RTF'
$doc.saveas([ref] $openfile , [ref] xxxxx)
$openfile = $filePath+'\'+$filename + '.htm'
$doc.SaveAs([ref] $openfile , [ref] xxxxx )
$openfile = $filePath+'\'+$filename +'.TXT'
$doc.saveas([ref] $openfile, [ref] xxxxx )

$doc.close()
$word.Quit()

#Start-Sleep -s xxxxx
$acl = Get-Acl $filePath
#$user = 'flhlaw\'+ $attr.SamAccountName

get-ChildItem $filePath -Recurse | Set-Acl -AclObject $Acl

#$filePath+'\'+$filename +'.RTF
#$filePath+'\'+$filename +'.htm
#$filePath+'\'+$filename +'.txt
}

Open in new window

Senior IT System EngineerSenior Systems EngineerAuthor Commented:
Thanks for the reply,

not sure what to modify and how to set the GPO settings to make it in effect ?
yo_beeDirector of Information TechnologyCommented:
I am not at my computer for the weekend so it would be a bit tough for me to work up. If you can wait until Monday I will be more than happy to help is no one else response.
yo_beeDirector of Information TechnologyCommented:
Before I start working this up are you looking to apply this across your entire domain and what are you criteria's that you want populated based on the OU?

e.g.
Fullname
Company Name
Department
Title
direct number
cell number
etc.......
Senior IT System EngineerSenior Systems EngineerAuthor Commented:
Yes, that's correct yobee.
For each OU the HTML template is differrent (diferent departemen signature.).
yo_beeDirector of Information TechnologyCommented:
You can have a domain wide script that queries the OU and on that criteria the signature is created.

To help you work this up please give me the static and dynamic fields you want in your signature.
Senior IT System EngineerSenior Systems EngineerAuthor Commented:
Dynamic:
First Name
Position / Title
City
Email address
Phone number

Static:
... Fax
Address
Adam the 32-bit AardvarkSoftware DeveloperCommented:
You may also want to take a look at this article: https://www.codetwo.com/admins-blog/active-directory-outlook-signature-vbs-script/ which describes how to prepare a VB script to add signatures in Outlooks. There is also a step-by-step instruction on how to deploy the script via GPO. It is not optimized for different OUs but still may come in handy.

All the best,
yo_beeDirector of Information TechnologyCommented:
Rather than write something out I figured I google it and found this gem of a script.
 I can help you clean it up, but it would be good for you to try yourself.
http://www.danielclasson.com/powershell-script-to-set-outlook-signature-in-office-2010-and-office-2013-using-information-populated-from-active-directory/

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Senior IT System EngineerSenior Systems EngineerAuthor Commented:
Yo_Bee,

Thanks for the assistant, somehow the script does not work for Office 2016 or 365 client ?

In Office 2013 below or older, it works. Do I need to do something to edit the script or load some ADMX in the Active Directory ?
yo_beeDirector of Information TechnologyCommented:
Do you have a think client version of office on your computer?
Senior IT System EngineerSenior Systems EngineerAuthor Commented:
No, it is Office ProPlus 2016 that does not work ?
yo_beeDirector of Information TechnologyCommented:
Let me see what the script is doing and I will get back to you
yo_beeDirector of Information TechnologyCommented:
Can you verify that the signature files are getting created in the %appdata%\Microsoft\Signature location?
Senior IT System EngineerSenior Systems EngineerAuthor Commented:
OK, I finally get it to work by using: https://gallery.technet.microsoft.com/office/Set-Outlook-20102013-8341e049

But how to modify it so that it can be used with Office Outlook 2016 ?

<# 
.SYNOPSIS 
Script to set Outlook 2010/2013 e-mail signature using Active Directory information 
.DESCRIPTION 
This script will set the Outlook 2010/2013 e-mail signature on the local client using Active Directory information.  
The template is created with a Word document, where images can be inserted and AD values can be provided. 
 
Author: Daniel Classon 
Version 2.4 
 
.DISCLAIMER 
All scripts and other powershell references are offered AS IS with no warranty. 
These script and functions are tested in my environment and it is recommended that you test these scripts in a test environment before using in your production environment. 
#> 
 
 
#Custom variables 
$SignatureName = '' #insert the company name (no spaces) 
$SigSource = "" #Change if desired for signature templates 
$SignatureVersion = "1.0" #Change this if you have updated the signature. If you do not change it, the script will quit after checking for the version already on the machine 
$ForceSignature = $False 
  
#Environment variables 
$AppData=(Get-Item env:appdata).value 
$SigPath = '\Microsoft\Signatures' #This is different depending on system language. I.e Swedish is 'Microsoft\Signaturer' 
$LocalSignaturePath = $AppData+$SigPath 
$RemoteSignaturePathFull = $SigSource 
 
#Copy version file 
If (-not(Test-Path -Path "C:\ProgramData\Microsoft\OFFICE\Signature\Version\$SignatureVersion")) { 
    New-Item -Path "C:\ProgramData\Microsoft\OFFICE\Signature\Version\$SignatureVersion" -ItemType Directory 
} 
Elseif (Test-Path -Path "C:\ProgramData\Microsoft\OFFICE\Signature\Version\$SignatureVersion") { 
    Write-Output "Latest signature already exists" 
    break 
} 
 
#Check signature path (needs to be created if a signature has never been created for the profile 
If (-not(Test-Path -path $LocalSignaturePath)) { 
    New-Item $LocalSignaturePath -Type Directory 
} 
 
#Get Active Directory information for current user 
$UserName = $env:username 
$Filter = "(&(objectCategory=User)(samAccountName=$UserName))" 
$Searcher = New-Object System.DirectoryServices.DirectorySearcher 
$Searcher.Filter = $Filter 
$ADUserPath = $Searcher.FindOne() 
$ADUser = $ADUserPath.GetDirectoryEntry() 
$ADDisplayName = $ADUser.DisplayName 
$ADEmailAddress = $ADUser.mail 
$ADTitle = $ADUser.title 
$ADDescription = $ADUser.description 
$ADTelePhoneNumber = $ADUser.TelephoneNumber 
$ADMobile = $ADUser.mobile 
$ADStreetAddress = $ADUser.streetaddress 
$ADCity = $ADUser.l 
$ADDepartment = $ADUser.department 
$ADCustomAttribute1 = $ADUser.extensionAttribute1 
$ADCustomAttribute2 = $ADUser.extensionAttribute2 
$ADCustomAttribute3 = $ADUser.extensionAttribute3 
$ADModify = $ADUser.whenChanged 
 
#Copy signature templates from source to local Signature-folder 
Write-Output "Copying Signatures" 
Copy-Item "$Sigsource" $LocalSignaturePath -Recurse -Force 
$ReplaceAll = 2 
$FindContinue = 1 
$MatchCase = $False 
$MatchWholeWord = $True 
$MatchWildcards = $False 
$MatchSoundsLike = $False 
$MatchAllWordForms = $False 
$Forward = $True 
$Wrap = $FindContinue 
$Format = $False 
     
#Insert variables from Active Directory to rtf signature-file 
$MSWord = New-Object -ComObject word.application 
$fullPath = $LocalSignaturePath+'\'+$SignatureName+'.docx' 
$MSWord.Documents.Open($fullPath) 
     
#ExtensionAttribute2 
Write-Host "Value is $ADCustomAttribute2" 
$FindText = "ExtensionAttribute2" 
$ReplaceText = $ADCustomAttribute2.ToString() 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
 
#ExtensionAttribute3 
$FindText = "ExtensionAttribute3" 
$ReplaceText = $ADCustomAttribute3.ToString() 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
 
#User Name $ Designation  
$FindText = "DisplayName"  
$Designation = $ADCustomAttribute1.ToString() 
If ($Designation -ne '') {  
    $Name = $ADDisplayName.ToString() 
    $ReplaceText = $Name+', '+$Designation 
} 
Else { 
    $ReplaceText = $ADDisplayName.ToString()  
} 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    )     
 
#Department 
$FindText = "Department" 
$ReplaceText = $ADDepartment.ToString() 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
 
#Title         
$FindText = "Title" 
$ReplaceText = $ADTitle.ToString() 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
     
#Description 
If ($ADDescription -ne '') {  
       $FindText = "Description" 
       $ReplaceText = $ADDescription.ToString() 
} 
Else { 
    $FindText = " | Description " 
       $ReplaceText = "".ToString() 
} 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
#$LogInfo += $NL+'Description: '+$ReplaceText 
        
#Street Address 
If ($ADStreetAddress -ne '') {  
       $FindText = "StreetAddress" 
    $ReplaceText = $ADStreetAddress.ToString() 
} 
Else { 
    $FindText = "StreetAddress" 
    $ReplaceText = $DefaultAddress 
    } 
    $MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
 
#City 
If ($ADCity -ne '') {  
    $FindText = "City" 
       $ReplaceText = $ADCity.ToString() 
   } 
Else { 
    $FindText = "City" 
    $ReplaceText = $DefaultCity  
   } 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
     
#Telephone 
If ($ADTelephoneNumber -ne "") {  
    $FindText = "TelephoneNumber" 
    $ReplaceText = $ADTelephoneNumber.ToString() 
   } 
Else { 
    $FindText = "TelephoneNumber" 
    $ReplaceText = $DefaultTelephone 
    } 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
     
#Mobile 
If ($ADMobile -ne "") {  
    $FindText = "MobileNumber" 
    $ReplaceText = $ADMobile.ToString() 
   } 
Else { 
    $FindText = "| Mob MobileNumber " 
    $ReplaceText = "".ToString() 
    } 
$MSWord.Selection.Find.Execute($FindText, $MatchCase, $MatchWholeWord,    $MatchWildcards, $MatchSoundsLike, $MatchAllWordForms, $Forward, $Wrap,    $Format, $ReplaceText, $ReplaceAll    ) 
 
#Save new message signature  
Write-Output "Saving signatures" 
#Save HTML 
$saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat], "wdFormatHTML"); 
$path = $LocalSignaturePath+'\'+$SignatureName+".htm" 
$MSWord.ActiveDocument.saveas([ref]$path, [ref]$saveFormat) 
     
#Save RTF  
$saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat], "wdFormatRTF"); 
$path = $LocalSignaturePath+'\'+$SignatureName+".rtf" 
$MSWord.ActiveDocument.SaveAs([ref] $path, [ref]$saveFormat) 
     
#Save TXT     
$saveFormat = [Enum]::Parse([Microsoft.Office.Interop.Word.WdSaveFormat], "wdFormatText"); 
$path = $LocalSignaturePath+'\'+$SignatureName+".txt" 
$MSWord.ActiveDocument.SaveAs([ref] $path, [ref]$SaveFormat) 
$MSWord.ActiveDocument.Close() 
$MSWord.Quit() 
     
 
#Office 2010 
If ((Test-Path HKCU:'\Software\Microsoft\Office\14.0') -and ($ForceSignature -eq $false))  { 
    Write-Output "Setting Office 2010 signature as available" 
    Try { 
        Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\14.0\Common\MailSettings -Name ReplySignature -Force -ErrorAction SilentlyContinue -Verbose 
        Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\14.0\Common\MailSettings -Name NewSignature -Force -ErrorAction SilentlyContinue -Verbose 
    } 
    Catch { 
    } 
    $MSWord = New-Object -comobject word.application 
    $EmailOptions = $MSWord.EmailOptions 
    $EmailSignature = $EmailOptions.EmailSignature 
    $EmailSignatureEntries = $EmailSignature.EmailSignatureEntries 
    $EmailSignature.NewMessageSignature=$SignatureName 
    $EmailSignature.ReplyMessageSignature=$SignatureName 
} 
 
If ((Test-Path HKCU:'\Software\Microsoft\Office\14.0') -and ($ForceSignature -eq $True)) { 
    Write-Output "Setting signature for Office 2010 as forced" 
    New-ItemProperty HKCU:'\Software\Microsoft\Office\14.0\Common\MailSettings' -Name 'ReplySignature' -Value $SignatureName -PropertyType 'String' -Force 
    New-ItemProperty HKCU:'\Software\Microsoft\Office\14.0\Common\MailSettings' -Name 'NewSignature' -Value $SignatureName -PropertyType 'String' -Force 
} 
 
#Office 2013 signature 
 
If ((Test-Path HKCU:'\Software\Microsoft\Office\15.0') -and ($ForceSignature -eq $False)) { 
    Write-Output "Setting Office 2013 signature as available" 
    Try { 
        Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Common\MailSettings -Name ReplySignature -Force -ErrorAction SilentlyContinue 
        Remove-ItemProperty -Path HKCU:\Software\Microsoft\Office\15.0\Common\MailSettings -Name NewSignature -Force -ErrorAction SilentlyContinue 
    } 
    Catch { 
    } 
    $MSWord = New-Object -comobject word.application 
    $EmailOptions = $MSWord.EmailOptions 
    $EmailSignature = $EmailOptions.EmailSignature 
    $EmailSignatureEntries = $EmailSignature.EmailSignatureEntries 
    #$EmailSignature.NewMessageSignature=$SignatureName 
    #$EmailSignature.ReplyMessageSignature=$SignatureName 
} 
 
If ((Test-Path HKCU:'\Software\Microsoft\Office\15.0') -and ($ForceSignature -eq $true)) { 
    Write-Output "Setting signature for Office 2013 as forced" 
    If (Get-ItemProperty -Name 'NewSignature' -Path HKCU:'\Software\Microsoft\Office\15.0\Common\MailSettings') { }  
    Else {  
        New-ItemProperty HKCU:'\Software\Microsoft\Office\15.0\Common\MailSettings' -Name 'NewSignature' -Value $SignatureName -PropertyType 'String' -Force  
    }  
    If (Get-ItemProperty -Name 'ReplySignature' -Path HKCU:'\Software\Microsoft\Office\15.0\Common\MailSettings') { }  
    Else {  
        New-ItemProperty HKCU:'\Software\Microsoft\Office\15.0\Common\MailSettings' -Name 'ReplySignature' -Value $SignatureName -PropertyType 'String' -Force 
    }  
}

Open in new window

yo_beeDirector of Information TechnologyCommented:
How did you get it to work?
You never replied back to my question of if the files were even created.
I think the part that you are not seeing is the registry write due to the version of Office and the logic that is applied from LINES  192 - 243

This part is using logic to see if the version you are on and were to commit the registry settings.
you will need to copy lines 215-243 and replace 15.0 with 16.0 all the lines you copied.  Once you have done this you will have a script that will work for 2010,2013,2016.
PberSolutions ArchitectCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Split:
-- yo_bee (https:#a42265143)
-- Senior IT System Engineer (https:#a42274790)
-- CodeTwo Software (https:#a42264726)


If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Pber
Experts-Exchange Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.