forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-Office365DLMV.ps1
653 lines (486 loc) · 26.2 KB
/
set-Office365DLMV.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
<#
.SYNOPSIS
This function sets the multi valued attributes of the DL
.DESCRIPTION
This function sets the multi valued attributes of the DL.
For each of use - I've combined these into a single function instead of splitting them out.dddd
.PARAMETER originalDLConfiguration
The original configuration of the DL on premises.
.PARAMETER exchangeDLMembership
The array of members of the group.
.PARAMETER exchangeRejectMessages
The array of objects with reject message permissions.
.PARAMETER exchangeAcceptMessages
The array of users with accept message permissions.
.PARAMETER exchangeManagedBy
The array of objects with managedBY permissions.
.PARAMETER exchangeModeratedBy
The array of moderators.
.PARAMETER exchangeBypassModeration
The list of users / groups that have bypass moderation rights.
.PARAMETER exchangeFrantSendOnBehalfTo
The list of objecst that have grant send on behalf to rights.
.OUTPUTS
None
.EXAMPLE
set-Office365DLMV -originalDLConfiguration -exchangeDLMembership -exchangeRejectMessage -exchangeAcceptMessage -exchangeManagedBy -exchangeModeratedBy -exchangeBypassMOderation -exchangeGrantSendOnBehalfTo.
[array$exchangeDLMembershipSMTP=$NULL
[array]$exchangeRejectMessagesSMTP=$NULL
[array]$exchangeAcceptMessageSMTP=$NULL
[array]$exchangeManagedBySMTP=$NULL
[array]$exchangeModeratedBySMTP=
[array]$exchangeBypassModerationSMTP=$NULL
[array]$exchangeGrantSendOnBehalfToSMTP
#>
Function set-Office365DLMV
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
$originalDLConfiguration,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeDLMembershipSMTP=$NULL,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeRejectMessagesSMTP=$NULL,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeAcceptMessageSMTP=$NULL,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeManagedBySMTP=$NULL,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeModeratedBySMTP=$NULL,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeBypassModerationSMTP=$NULL,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeGrantSendOnBehalfToSMTP=$NULL,
[Parameter(Mandatory = $true)]
[AllowEmptyCollection()]
[array]$exchangeSendAsSMTP=$NULL,
[Parameter(Mandatory=$true)]
[string]$groupTypeOverride,
[Parameter(Mandatory=$true)]
$newDLPrimarySMTPAddress
)
#Declare function variables.
[array]$functionDirectoryObjectID = $NULL
$functionEmailAddress = $NULL
[boolean]$routingAddressIsPresent=$FALSE
[string]$hybridRemoteRoutingAddress=$NULL
[string]$workingAddress=$NULL
[array]$workingAddressArray=@()
[int]$functionLoopCounter=0
[boolean]$functionFirstRun=$TRUE
[array]$functionRecipients=@()
[array]$functionEmailAddresses=@()
#Start function processing.
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN SET-Office365DLMV"
Out-LogFile -string "********************************************************************************"
#Log the parameters and variables for the function.
Out-LogFile -string ("OriginalDLConfiguration = ")
out-logfile -string $originalDLConfiguration
out-logfile -string "Resetting all SMTP addresses on the object to match on premises."
foreach ($address in $originalDLConfiguration.proxyAddresses)
{
if ($address.contains("mail.onmicrosoft.com"))
{
out-logfile -string ("Hybrid remote routing address found.")
out-logfile -string $address
$routingAddressIsPresent=$TRUE
}
out-logfile -string $address
$functionEmailAddresses+=$address.tostring()
}
Set-O365DistributionGroup -identity $originalDLConfiguration.mailNickName -emailAddresses $functionEmailAddresses -errorAction STOP -BypassSecurityGroupManagerCheck
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
out-logfile -string "Processing on premises legacy ExchangeDN to X500"
out-logfile -string $originalDLConfiguration.legacyExchangeDN
$functionEmailAddress = "X500:"+$originalDLConfiguration.legacyExchangeDN
out-logfile -string ("The x500 address to process = "+$functionEmailAddress)
try {
Set-O365DistributionGroup -identity $originalDLConfiguration.mailNickName -emailAddresses @{add=$functionEmailAddress} -errorAction STOP -BypassSecurityGroupManagerCheck
}
catch {
out-logfile -string $_ -isError:$TRUE
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
if ($routingAddressIsPresent -eq $FALSE)
{
out-logfile -string "A hybrid remote routing address was not present. Adding hybrid remote routing address."
$workingAddress=$newDLPrimarySMTPAddress.substring($newDLPrimarySMTPAddress.indexof("@"))
$workingAddressArray=$workingaddress.split(".")
$hybridRemoteRoutingAddress=$originalDLConfiguration.mailnickname+$workingAddressArray[0]+".mail."+$workingAddressArray[1]+"."+$workingAddressArray[2]
out-logfile -string ("Hybrid remote routing address = "+$hybridRemoteRoutingAddress)
try {
Set-O365DistributionGroup -identity $originalDLConfiguration.mailNickName -emailAddresses @{add=$hybridRemoteRoutingAddress} -errorAction STOP -BypassSecurityGroupManagerCheck
}
catch {
out-logfile -string $_ -isError:$TRUE
}
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
out-logFile -string "Evaluating exchangeDLMembershipSMTP"
if ($exchangeDLMembershipSMTP -ne $NULL)
{
<#
foreach ($member in $exchangeDLMembershipSMTP)
{
#Implement some protections for larger operations to ensure we do not exhaust our powershell budget.
if ($functionLoopCounter -eq 1000)
{
out-logfile -string "Sleeping for 5 seconds - powershell refresh interval"
start-sleep -seconds 5
$functionLoopCounter = 0
}
else
{
out-logfile -string ("Function Loop Counter = "+$functionLoopCounter)
$functionLoopCounter++
}
#If the recipient type is a group - set error action to silientlyContinue.
#This is required - if the group is retained we set the same custom attributes as the cross premises contact created.
#Therefore there could be an exception that th member already exists.
if ($member.RecipientType -eq "group")
{
out-logfile -string "Member is a group - setting error action to continue."
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Continue
}
else
{
out-logfile -string "Member is not a group - setting error action to stop."
$ErrorActionPreference = [System.Management.Automation.ActionPreference]::Stop
}
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
try {
add-O365DistributionGroupMember -identity $originalDLConfiguration.mailnickname -member $functionDirectoryObjectID[1] -BypassSecurityGroupManagerCheck
}
catch {
out-logfile -string "Unable to add member. "
out-logfile -string $member.externalDirectoryObjectID -isError:$TRUE
}
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
try {
add-O365DistributionGroupMember -identity $originalDLConfiguration.mailNickName -member $member.primarySMTPAddressOrUPN -BypassSecurityGroupManagerCheck
}
catch {
out-logfile -string "Unable to add member. "
out-logfile -string $member.primarySMTPAddressOrUPN -isError:$TRUE
}
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
#>
#<#
#Removing the original code that would iterate through each member and doing a bulk update
#All of the members were previously verified as present - so no member should be gone by now unless removed.
#This adds all members as a single operation. Errors we silently continue.
#Ensureing all addresses in the array are unique.
foreach ($member in $exchangeDLMembershipSMTP)
{
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-logfile -string ("Processing directory ID: "+$member.ExternalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
$functionRecipients+=$functionDirectoryObjectID[1]
}
else
{
out-logfile -string ("Processing SMTPAddress: "+$member.primarySMTPAddressOrUPN)
$functionRecipients+=$member.primarySMTPAddressOrUPN
}
}
#Becuase groups could have been mirgated and retained - this ensures that all SMTP addresses and GUIDs in the array are unique.
$functionRecipients = $functionRecipients | select-object -Unique
out-logfile -string "Updating membership with unique values."
out-logfile -string $functionRecipients
#Using update to reset the entire membership of the DL to the unique array.
#Alberto Larrinaga for the suggestion.
update-o365DistributionGroupMember -identity $originalDLConfiguration.mailNickName -members $functionRecipients -BypassSecurityGroupManagerCheck -confirm:$FALSE -errorAction SilentlyContinue -verbose
##>
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
$functionRecipients=@() #Reset the test array.
out-logFile -string "Evaluating exchangeRejectMessagesSMTP"
if ($exchangeRejectMessagesSMTP -ne $NULL)
{
foreach ($member in $exchangeRejectMessagesSMTP)
{
#Implement some protections for larger operations to ensure we do not exhaust our powershell budget.
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
$functionRecipients+=$functionDirectoryObjectID[1]
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
$functionRecipients+=$member.primarySMTPAddressOrUPN
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
#Becuase groups could have been mirgated and retained - this ensures that all SMTP addresses and GUIDs in the array are unique.
$functionRecipients = $functionRecipients | select-object -Unique
out-logfile -string "Updating reject messages SMTP with unique values."
out-logfile -string $functionRecipients
set-o365DistributionGroup -identity $originalDLConfiguration.mailNickName -RejectMessagesFromSendersOrMembers $functionRecipients -errorAction STOP -BypassSecurityGroupManagerCheck
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
$functionRecipients=@() #Reset the test array.
out-logFile -string "Evaluating exchangeAcceptMessagesSMTP"
if ($exchangeAcceptMessageSMTP -ne $NULL)
{
foreach ($member in $exchangeAcceptMessageSMTP)
{
#Implement some protections for larger operations to ensure we do not exhaust our powershell budget.
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
$functionRecipients+=$functionDirectoryObjectID[1]
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
$functionRecipients+=$member.primarySMTPAddressOrUPN
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
#Becuase groups could have been mirgated and retained - this ensures that all SMTP addresses and GUIDs in the array are unique.
$functionRecipients = $functionRecipients | select-object -Unique
out-logfile -string "Updating accept messages SMTP with unique values."
out-logfile -string $functionRecipients
set-o365DistributionGroup -identity $originalDLConfiguration.mailNickName -AcceptMessagesOnlyFromSendersOrMembers $functionRecipients -errorAction STOP -BypassSecurityGroupManagerCheck
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
$functionRecipients=@() #Reset the test array.
out-logFile -string "Evaluating exchangeManagedBySMTP"
if ($exchangeManagedBySMTP -ne $NULL)
{
foreach ($member in $exchangeManagedBySMTP)
{
#Implement some protections for larger operations to ensure we do not exhaust our powershell budget.
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
$functionRecipients+=$functionDirectoryObjectID[1]
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
$functionRecipients+=$member.primarySMTPAddressOrUPN
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
#Becuase groups could have been mirgated and retained - this ensures that all SMTP addresses and GUIDs in the array are unique.
$functionRecipients = $functionRecipients | select-object -Unique
out-logfile -string "Updating managed by SMTP with unique values."
out-logfile -string $functionRecipients
set-o365DistributionGroup -identity $originalDLConfiguration.mailNickName -managedBy $functionRecipients -errorAction STOP -BypassSecurityGroupManagerCheck
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
$functionRecipients=@() #Reset the test array.
out-logFile -string "Evaluating exchangeModeratedBy"
if ($exchangeModeratedBySMTP -ne $NULL)
{
foreach ($member in $exchangeModeratedBySMTP)
{
#Implement some protections for larger operations to ensure we do not exhaust our powershell budget.
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
$functionRecipients+=$functionDirectoryObjectID[1]
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
$functionRecipients+=$member.primarySMTPAddressOrUPN
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
#Becuase groups could have been mirgated and retained - this ensures that all SMTP addresses and GUIDs in the array are unique.
$functionRecipients = $functionRecipients | select-object -Unique
out-logfile -string "Updating moderated by SMTP with unique values."
out-logfile -string $functionRecipients
set-o365DistributionGroup -identity $originalDLConfiguration.mailNickName -moderatedBy $functionRecipients -errorAction STOP -BypassSecurityGroupManagerCheck
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
$functionRecipients=@() #Reset the test array.
out-logFile -string "Evaluating exchangeBypassModerationSMTP"
if ($exchangeBypassModerationSMTP -ne $NULL)
{
foreach ($member in $exchangeBypassModerationSMTP)
{
#Implement some protections for larger operations to ensure we do not exhaust our powershell budget.
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
$functionRecipients+=$functionDirectoryObjectID[1]
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
$functionRecipients+=$member.primarySMTPAddressOrUPN
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
#Becuase groups could have been mirgated and retained - this ensures that all SMTP addresses and GUIDs in the array are unique.
$functionRecipients = $functionRecipients | select-object -Unique
out-logfile -string "Updating bypass moderation from senders or members SMTP with unique values."
out-logfile -string $functionRecipients
set-o365DistributionGroup -identity $originalDLConfiguration.mailNickName -BypassModerationFromSendersOrMembers $functionRecipients -errorAction STOP -BypassSecurityGroupManagerCheck
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
$functionRecipients=@() #Reset the test array.
out-logFile -string "Evaluating exchangeGrantSendOnBehalfToSMTP"
if ($exchangeGrantSendOnBehalfToSMTP -ne $NULL)
{
foreach ($member in $exchangeGrantSendOnBehalfToSMTP)
{
#Implement some protections for larger operations to ensure we do not exhaust our powershell budget.
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
$functionRecipients+=$functionDirectoryObjectID[1]
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
$functionRecipients+=$member.primarySMTPAddressOrUPN
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
#Becuase groups could have been mirgated and retained - this ensures that all SMTP addresses and GUIDs in the array are unique.
$functionRecipients = $functionRecipients | select-object -Unique
out-logfile -string "Updating grant send on behalf to SMTP with unique values."
out-logfile -string $functionRecipients
set-o365DistributionGroup -identity $originalDLConfiguration.mailNickName -GrantSendOnBehalfTo $functionRecipients -errorAction STOP -BypassSecurityGroupManagerCheck
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
out-logFile -string "Evaluating exchangeSendAsSMTP"
if ($exchangeSendAsSMTP -ne $NULL)
{
foreach ($member in $exchangeSendAsSMTP)
{
if ($member.externalDirectoryObjectID -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.externalDirectoryObjectID)
$functionDirectoryObjectID=$member.externalDirectoryObjectID.Split("_")
out-LogFile -string ("Processing updated member = "+$functionDirectoryObjectID[1])
try {
add-o365RecipientPermission -Identity $originalDLConfiguration.mailNickName -Trustee $functionDirectoryObjectID[1] -AccessRights "SendAs" -confirm:$FALSE
}
catch {
out-logfile -string "Unable to add member. "
out-logfile -string $member.externalDirectoryObjectID -isError:$TRUE
}
}
elseif ($member.primarySMTPAddressOrUPN -ne $NULL)
{
out-LogFile -string ("Processing member = "+$member.PrimarySMTPAddressOrUPN)
try {
add-o365RecipientPermission -Identity $originalDLConfiguration.mailNickName -Trustee $member.primarySMTPAddressOrUPN -AccessRights "SendAs" -confirm:$FALSE
}
catch {
out-logfile -string "Unable to add member. "
out-logfile -string $member.primarySMTPAddressOrUPN -isError:$TRUE
}
}
else
{
out-logfile -string "Invalid function object for recipient." -isError:$TRUE
}
}
}
else
{
Out-LogFile -string "There were no members to process."
}
$global:unDoStatus=$global:unDoStatus+1
out-Logfile -string ("Global UNDO Status = "+$global:unDoStatus.tostring())
Out-LogFile -string "END SET-Office365DLMV"
Out-LogFile -string "********************************************************************************"
}