Bulk update/modify email signature using powershell

$import= import-csv -Path ‘\email-list.csv’ #location of CSV file

$import | ForEach-Object {

$stringSignature = get-MailboxMessageConfiguration -Identity $_.identity.trim() | fl signatureHTML

$string = $stringSignature | Out-String #to convert to string....

$string = $string -replace "logo.png", "newlogo.png"

if($string -like 'maharjanrajan.com') { #to check if the stringg exists
    $string = $string -replace "maharjanrajan.com", "rajanmaharjan.com"
} 

$string = $string -replace "SignatureHtml : ", "" #to replace the word SignatureHtml : which comes when converting to string from above 

$string = $string -replace '<div></div>', ''  #replace unnecessary open close of div without content   

Set-MailboxMessageConfiguration -Identity $_.identity.trim() -DefaultFontName 'Arial' -AutoAddSignature $true -AutoAddSignatureOnReply $true -SignatureHtml $string

Write-host $_.identity 'Signature Modified' 

}

Leave a Reply

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

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top