Skip to content

Instantly share code, notes, and snippets.

@andreagx
Created February 18, 2014 09:46
Show Gist options
  • Select an option

  • Save andreagx/9067720 to your computer and use it in GitHub Desktop.

Select an option

Save andreagx/9067720 to your computer and use it in GitHub Desktop.
# OWA Signature import by Andrea Gallazzi www.andreagallazzi.com
#var old is text to remove
$old = 'src=".+?_file/image001.gif"'
#var $new = the text you want to replace
$new = 'src="http://www.mypublicwebsite.com/image001.gif"'
#change the Get-ChildItem to a folder or your choice
Get-ChildItem C:\Signatures\*.htm | Where {$_ -IS [IO.FileInfo]} |
% {
(Get-Content $_.FullName) -replace $old, $new | Set-Content $_.FullName
Write-Host "----- WORKING ----------"
Write-Host "Processed: " + $_.FullName
}
#REMOVE DONE
# Import OWA Signatures in EMS
$mailboxes = Get-Mailbox
$mailboxes| foreach {$file= "C:\Signatures\" + ($_.alias) + ".htm"; Set-MailboxMessageConfiguration -identity $_.alias -AutoAddSignature $True -SignatureHtml "$(Get-Content -Path $file -ReadCount 0)"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment