Oprettelse af adressebogspolitik i Exchange Server med PowerShell-script.
Script til at lave AL og GAL lister i Exchange. De skal køres i Exchange Management Shell på EXCH-01 eller 02
- Åbn EXCH-01, og åbn script
- Skift firmanavn i script
$FirmName = “firma”
$Filter = “Alias -ne $null
-and CustomAttribute1 -eq "$FirmName
“”
Get-mailbox -Filter $Filter | Set-Mailbox -AddressBookPolicy $null
Start-Sleep -s 6
Remove-AddressBookPolicy -Identity “$FirmName”
Remove-OfflineAddressBook -Identity “$FirmName OAB”
Remove-GlobalAddressList -Identity “$FirmName GAL”
Remove-AddressList -Identity “$FirmName AL”
New-AddressList -Name “$FirmName AL” -RecipientFilter $Filter
New-GlobalAddressList -Name “$FirmName GAL” -RecipientFilter $Filter
New-OfflineAddressBook -Name “$FirmName OAB” -AddressLists “\$FirmName GAL” -GlobalWebDistributionEnabled $true
New-AddressBookPolicy -Name “$FirmName” -Addresslists “\$FirmName AL” -RoomList “\All Rooms” -OfflineAddressBook “\$FirmName OAB” -GlobalAddressList “\$FirmName GAL”
Start-Sleep -s 10
Scriptet kan også findes i mappen script.
Når det er kørt, er der blevet lavet AL og GAL med Attribute1 firmanavn.
English
Title: Script to Manage Exchange Server Objects for a Specific Firm
Summary: This article provides a PowerShell script that automates the process of creating and managing Exchange Server objects, such as Address Lists, Global Address Lists, Offline Address Books, and Address Book Policies, for a specific firm or organization.
Description:
This PowerShell script is designed to help organizations manage their Exchange Server objects for a specific firm or organization. The script allows administrators to create and manage Address Lists, Global Address Lists, Offline Address Books, and Address Book Policies based on a custom filter.
The script works in the following way:
- The script defines two variables:
$FirmName
, which specifies the name of the firm, and$Filter
, which defines a custom filter based on the firm name. The filter selects mailboxes that have a custom attribute called “CustomAttribute1” set to the firm name. - The script then removes the existing Address Book Policy, Offline Address Book, Global Address List, and Address List for the specified firm, and dissociates them from any associated mailboxes. This ensures that the script is starting with a clean slate and that any existing objects are not interfering with the creation of new objects.
- The script then creates a new Address List, Global Address List, Offline Address Book, and Address Book Policy for the specified firm, based on the custom filter. The Address List and Global Address List are named after the firm name, and the Offline Address Book is named after the firm name with “OAB” appended. The Address Book Policy is named after the firm name as well.
- Finally, the script assigns the new Address Book Policy to the mailboxes that match the filter. This ensures that the mailboxes associated with the firm are using the correct Address Book Policy.
It is important to note that this script is designed to be edited to match the specific requirements of the organization. The $FirmName
and $Filter
variables should be edited to match the name and custom attribute of the firm, and the Address List, Global Address List, Offline Address Book, and Address Book Policy settings should be adjusted to