Active-Directory

Exchange OWA 2010 簽名策略

  • May 13, 2013

我有一個 Exchange 2010 環境。對於 Outlook(桌面版),我們在組策略中設置了腳本,以在整個組織中推出標準化簽名。我想為 OWA 做同樣的事情,但是

  1. 我不想使用傳輸規則,因為使用者在編寫消息時看不到他們的簽名。我們希望他們能夠看到簽名
  2. 有很多軟體可以做到這一點,但我們正在努力降低成本。

如果我使用 Set-MailboxMessageConfiguration,在給定交換使用者 ID 的情況下,是否可以從 Active Directory 中提取數據以進行簽名?我知道這樣我就必須按計劃執行腳本來處理任何更新和新使用者。

我慢慢設法編寫了一個滿足我需要的腳本,我將分享一個經過消毒的版本。對於每個郵箱,指定他們的簽名 - 文本和 HTML 版本。根據使用者擁有的電話類型,它會相應地進行簽名。

Import-Module ActiveDirectory
. 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1' Connect-ExchangeServer -auto
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

$userList = get-mailbox -resultsize unlimited | where-object {$_.RecipientTypeDetails -eq "UserMailbox"} | sort-object alias

foreach($user in $userList)
{
   $ui = get-aduser $user.alias -properties *
   $telLine = ""
   $telLineHTML = ""
   $telLineText = ""

   if($ui.telephoneNumber -ne $null -and $ui.Mobile -ne $null -and $ui.Fax -ne $null){
       $telLine =  "Tel: " + $ui.telephoneNumber + " | Cell: " + $ui.Mobile + " | Fax: " + $ui.Fax
   }
   elseif($ui.telephoneNumber -ne $null -and $ui.Mobile -ne $null){
       $telLine =  "Tel: " + $ui.telephoneNumber + " | Cell: " + $ui.Mobile
   }
   elseif($ui.telephoneNumber -ne $null -and $ui.Fax -ne $null){
       $telLine =  "Tel: " + $ui.telephoneNumber + " | Fax: " + $ui.Fax
   }
   elseif($ui.telephoneNumber -ne $null){


$telLine =  "Tel: " + $ui.telephoneNumber
}
elseif($ui.Mobile -ne $null){
   $telLine =  "Cell: " + $ui.Mobile
}

if($telLine -ne "")
{
   $telLineHTML = $telLine + "<br>"
   $telLineText = $telLine + "`n"
}

$t = $ui.DisplayName + " | " + $ui.Title + "`n" + $ui.Company + "`n" + $ui.StreetAddress + ", " + $ui.City + ", " + $ui.State + ", " + $ui.PostalCode + "`n" + $telLineText + "Email: " + $ui.EmailAddress.ToLower()

$h = "<div style='font-family:Tahoma; font-size:13px'><span color='#041F3C' style='font-family:Calibri; font-size:10pt'><strong>" + $ui.DisplayName + " | </strong></span><span color='#F37021' style='font-family:Calibri; font-size:10pt'><strong><font color='#f37021'>" + $ui.Title + "</font></strong></span><br><span style='font-family:Calibri; font-size:10pt'>" + $ui.Company + "<br>" + $ui.StreetAddress + ", " + $ui.City + ", " + $ui.State + ", " + $ui.PostalCode + "<br>" + $telLineHTML + "Email: <a href='mailto:" + $ui.EmailAddress.ToLower() + "'>" + $ui.EmailAddress.ToLower() + "</a></span></div>"

   Set-MailboxMessageConfiguration $ui.SamAccountName -SignatureText $t -signatureHTML $h

   #get-MailboxMessageConfiguration $ui.SamAccountName | select SignatureText, SignatureHTML | format-list
}

引用自:https://serverfault.com/questions/506196