forked from timmcmic/DLConversionV2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-replaceOffice365Members.ps1
72 lines (46 loc) · 2.05 KB
/
start-replaceOffice365Members.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
<#
.SYNOPSIS
This function updates the membership of any cloud only distribution lists for the migrated distribution group.
.DESCRIPTION
This function updates the membership of any cloud only distribution lists for the migrated distribution group.
.PARAMETER office365Group
The member that is being added.
.PARAMETER groupSMTPAddress
The member that is being added.
.OUTPUTS
None
.EXAMPLE
sstart-replaceOffice365Members -office365Group $group -groupSMTPAddress $address
#>
Function start-replaceOffice365Members
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
$office365Group,
[Parameter(Mandatory = $true)]
[string]$groupSMTPAddress
)
#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)
[string]$isTestError="No"
#Start function processing.
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN start-ReplaceOffice365Members"
Out-LogFile -string "********************************************************************************"
#Log the parameters and variables for the function.
$functionCommand=$NULL
#Declare function variables.
out-Logfile -string "Processing operation..."
try{
add-o365DistributionGroupMember -identity $office365Group.primarySMTPAddress -member $groupSMTPAddress -errorAction STOP -BypassSecurityGroupManagerCheck
}
catch{
out-logfile -string $_
$isTestError="Yes"
}
Out-LogFile -string "END start-replaceOffice365Members"
Out-LogFile -string "********************************************************************************"
return $isTestError
}