-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathGet-O365GroupConfiguration.ps1
76 lines (51 loc) · 2.61 KB
/
Get-O365GroupConfiguration.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
<#
.SYNOPSIS
This function uses the exchange online powershell session to gather the office 365 distribution list configuration.
.DESCRIPTION
This function uses the exchange online powershell session to gather the office 365 distribution list configuration.
.PARAMETER GroupSMTPAddress
The mail attribute of the group to search.
.OUTPUTS
Returns the PS object associated with the recipient from get-o365recipient
.EXAMPLE
get-o365dlconfiguration -groupSMTPAddress Address -groupTypeOverride
#>
Function Get-o365GroupConfiguration
{
[cmdletbinding()]
Param
(
[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)
#Declare function variables.
$functionDLConfiguration=$NULL #Holds the return information for the group query.
$functionMailSecurity="MailUniversalSecurityGroup"
$functionMailDistribution="MailUniversalDistributionGroup"
$functionGroupType = "GroupMailbox"
#Start function processing.
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN GET-O365GroupCONFIGURATION"
Out-LogFile -string "********************************************************************************"
#Get the recipient using the exchange online powershell session.
try
{
out-logfile -string "Obtaining Office 365 DL Configuration for evaluation."
$functionRecipient = get-o365Group -identity $groupSMTPAddress -errorAction STOP
out-logfile -string "Successfully obtained the Office 365 DL Configuration."
}
catch
{
out-logfile -string "Unable to obtain the Office 365 DL Configuration."
out-logfile -string $_ -isError:$TRUE
}
out-logfile -string $functionRecipient
Out-LogFile -string "END GET-O365GroupCONFIGURATION"
Out-LogFile -string "********************************************************************************"
#This function is designed to open local and remote powershell sessions.
#If the session requires import - for example exchange - return the session for later work.
#If not no return is required.
return $functionRecipient
}