forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-nonSyncDL.ps1
132 lines (100 loc) · 4 KB
/
test-nonSyncDL.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<#
.SYNOPSIS
This function loops until we detect that the cloud DL is no longer present.
.DESCRIPTION
This function loops until we detect that the cloud DL is no longer present.
.PARAMETER originalDLConfiguration
The SMTP Address of the group.
.OUTPUTS
None
.EXAMPLE
test-CloudDLPresent -originalDLConfiguration $config
#>
Function test-nonSyncDL
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
$originalDLConfiguration
)
#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)
[array]$functionErrors=@()
#Start function processing.
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN TEST-NONSYNCDL"
Out-LogFile -string "********************************************************************************"
out-logfile -string "Testing mail attribute..."
if ($originalDLConfiguration.mail -eq $NULL)
{
$isErrorObject = new-Object psObject -property @{
Attribute = "Mail"
ErrorMessage = ("Mail attribute missing on non-syncDL and is required.")
ErrorMessageDetail = $_
}
$functionErrors+=$isErrorObject
}
else
{
out-logfile -string "Attribute mail is present."
}
out-logfile -string "Testing legacyExchangeDN attribute..."
if ($originalDLCOnfiguration.legacyExchangeDN -eq $NULL)
{
$isErrorObject = new-Object psObject -property @{
Attribute = "LegacyExchangeDN"
ErrorMessage = ("LegacyExchangeDN attribute missing on non-syncDL and is required.")
errorMessageDetail = $_
}
$functionErrors+=$isErrorObject
}
else
{
out-logfile -string "Attribute legacyExchangeDN is present."
}
out-logfile -string "Testing proxyAddresses attribute..."
if ($originalDLCOnfiguration.proxyAddresses -eq $NULL)
{
$isErrorObject = new-Object psObject -property @{
Attribute = "ProxyAddresses"
ErrorMessage = ("ProxyAddresses attribute missing on non-syncDL and is required.")
ErrorMessageDetail = $_
}
$functionErrors+=$isErrorObject
}
else
{
out-logfile -string "Attribute proxyAddresses is present."
}
out-logfile -string "Testing mailNickName attribute..."
if ($originalDLCOnfiguration.mailNickName -eq $NULL)
{
$isErrorObject = new-Object psObject -property @{
Attribute = "MailNickName"
ErrorMessage = ("MailNickName attribute missing on non-syncDL and is required.")
ErrorMessageDetail = $_
}
$functionErrors+=$isErrorObject
}
else
{
out-logfile -string "Attribute mailNickName is present."
}
if ($functionErrors.count -gt 0)
{
foreach ($error in $functionErrors)
{
out-logfile -string "Error detected in non sync DL."
out-logfile -string $error.attribute
out-logfile -string $error.errormessage
}
out-logfile -string "All errors must be corrected prior to non-sync DL migration." -isError:$TRUE
}
else
{
out-logfile -string "No attribute validation errors found proceed with migration."
}
Out-LogFile -string "END TEST-NONSYNCDL"
Out-LogFile -string "********************************************************************************"
}