-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathget-onPremFolderPermissions.ps1
71 lines (46 loc) · 2.46 KB
/
get-onPremFolderPermissions.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
<#
.SYNOPSIS
This function utilizes the collected data to search for mailbox folder permissions on the migrated DL.
.DESCRIPTION
This function utilizes the collected data to search for mailbox folder permissions on the migrated DL.
.PARAMETER originalDLConfiguration
The mail attribute of the group to search.
.PARAMETER collectedData
.OUTPUTS
Returns all default or user created mailbox folder permissions.
.EXAMPLE
get-o365dlconfiguration -groupSMTPAddress Address -collectedData Data
#>
Function get-onPremFolderPermissions
{
[cmdletbinding()]
Param
(
[Parameter(Mandatory = $true)]
$originalDLConfiguration,
[Parameter(Mandatory=$false)]
$collectedData=$NULL
)
#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.
[array]$functionFolderRightsUsers=@()
[int]$functionCounter=0
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "BEGIN get-onPremFolderPermissions"
Out-LogFile -string "********************************************************************************"
out-logfile -string "Test for folder permissions."
out-logfile -string "Filter all permissions for objects that are no longer valid"
out-logfile -string ("Pre collected data count: "+$collectedData.count)
$collectedData = $collectedData | where {$_.user.adrecipient -ne $NULL}
out-logfile -string ("Post collected data count: "+$collecteddata.count)
$functionFolderRightsUsers = $collectedData | where {($_.user.ADRecipient.primarySMTpAddress).tolower().contains($originalDLConfiguration.mail.toLower())}
Out-LogFile -string "********************************************************************************"
Out-LogFile -string "END get-onPremFolderPermissions"
Out-LogFile -string "********************************************************************************"
if ($functionFolderRightsUsers.count -gt 0)
{
out-logfile -string $functionFolderRightsUsers
return $functionFolderRightsUsers
}
}