-
Notifications
You must be signed in to change notification settings - Fork 10
/
convert-O365DLSettingsToOnPremSettings.ps1
111 lines (84 loc) · 4.84 KB
/
convert-O365DLSettingsToOnPremSettings.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
function convert-O365DLSettingsToOnPremSettings
{
<#
.SYNOPSIS
This function converts Office 365 Distribution List settings to on premises distribution list LDAP settings for code reuse.
.DESCRIPTION
Trigger function.
.PARAMETER OFFICE365DLCONFIGURATION
This is the configuration extracted from Office 365 for the group conversion.
.OUTPUTS
Returns DL attributes mapped to LDAP attributes.
.NOTES
The following blog posts maintain documentation regarding this module.
https://timmcmic.wordpress.com/2023/01/08/office-365-distribution-list-migration-version-2-0/
.EXAMPLE
convert-o365DLSettingsToOnPremisesSettings -office365DLConfiguration $office365DLConfiguration
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
$office365DLConfiguration
)
$functionGroupType = $NULL
$functionCloudSecurity = "MailUniversalSecurityGroup"
$functionADSecurity = "-2147483640"
#Output all parameters bound or unbound and their associated values.
write-functionParameters -keyArray $MyInvocation.MyCommand.Parameters.Keys -parameterArray $PSBoundParameters -variableArray (Get-Variable -Scope Local -ErrorAction Ignore)
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN convert-O365DLSettingsToOnPremSettings"
Out-LogFile -string "********************************************************************************"
if ($office365DLConfiguration.recipientType -eq $functionCloudSecurity)
{
out-logfile -string "Group is security type in Office 365 - setting active directory equivalent"
$functionGroupType = $functionADSecurity
}
else
{
$functionGroupType = "0"
}
out-logfile -string ("The function group type: "+$functionGroupType)
$functionObject = New-Object PSObject -Property @{
msExchEnableModeration=$office365DLConfiguration.ModerationEnabled
msExchHideFromAddressLists=$office365DLConfiguration.HiddenFromAddressListsEnabled
msExchRequireAuthToSendTo=$office365DLConfiguration.RequireSenderAuthenticationEnabled
mailNickName=$office365DLConfiguration.Alias
displayName=$office365DLConfiguration.DisplayName
msExchSenderHintTranslations=$office365DLConfiguration.MailTipTranslations
extensionAttribute1=$office365DLConfiguration.CustomAttribute1
extensionAttribute10=$office365DLConfiguration.CustomAttribute10
extensionAttribute11=$office365DLConfiguration.CustomAttribute11
extensionAttribute12=$office365DLConfiguration.CustomAttribute12
extensionAttribute13=$office365DLConfiguration.CustomAttribute13
extensionAttribute14=$office365DLConfiguration.CustomAttribute14
extensionAttribute15=$office365DLConfiguration.CustomAttribute15
extensionAttribute2=$office365DLConfiguration.CustomAttribute2
extensionAttribute3=$office365DLConfiguration.CustomAttribute3
extensionAttribute4=$office365DLConfiguration.CustomAttribute4
extensionAttribute5=$office365DLConfiguration.CustomAttribute5
extensionAttribute6=$office365DLConfiguration.CustomAttribute6
extensionAttribute7=$office365DLConfiguration.CustomAttribute7
extensionAttribute8=$office365DLConfiguration.CustomAttribute8
extensionAttribute9=$office365DLConfiguration.CustomAttribute9
msExchExtensionCustomAttribute1=$office365DLConfiguration.ExtensionCustomAttribute1
msExchExtensionCustomAttribute2=$office365DLConfiguration.ExtensionCustomAttribute2
msExchExtensionCustomAttribute3=$office365DLConfiguration.ExtensionCustomAttribute3
msExchExtensionCustomAttribute4=$office365DLConfiguration.ExtensionCustomAttribute4
msExchExtensionCustomAttribute5=$office365DLConfiguration.ExtensionCustomAttribute5
proxyAddresses=$office365DLConfiguration.EmailAddresses
mail=$office365DLConfiguration.WindowsEmailAddress
legacyExchangeDN=$office365DLConfiguration.LegacyExchangeDN
groupType=$functionGroupType
msExchRemoteRecipientType="N/A"
msExchRecipientDisplayType=$office365DLConfiguration.RecipientType
msExchRecipientTypeDetails=$office3365DLConfiguration.RecipientTypeDetails
'msDS-ExternalDirectoryObjectId' = $office365DLConfiguration.externalDirectoryObjectID
distinguishedName = $office365DLConfiguration.distinguishedName
name = $office365DLConfiguration.name
}
out-logfile -string $functionObject
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "END convert-O365DLSettingsToOnPremSettings"
Out-LogFile -string "********************************************************************************"
return $functionObject
}