Increase speed of permission acquisition

This commit is contained in:
Jérémi N ‘EndMove’ 2022-08-26 14:10:42 +02:00
parent acb5cfaf64
commit b52176cbdd
Signed by: EndMove
GPG Key ID: 65C4A02E1F5371A4
3 changed files with 7 additions and 7 deletions

View File

@ -7,7 +7,7 @@
[link-icon-website]: https://img.shields.io/badge/%F0%9F%92%BB-My%20Web%20Site-0078D4.svg [link-icon-website]: https://img.shields.io/badge/%F0%9F%92%BB-My%20Web%20Site-0078D4.svg
[link-website]: https://www.endmove.eu/ [link-website]: https://www.endmove.eu/
__Current version : *1.1.0*__ __Current version : *1.1.1*__
## Description ## Description

View File

@ -1,7 +1,7 @@
<## <##
# EXCAL-ARIGHTS - runable script (entrypoint) # EXCAL-ARIGHTS - runable script (entrypoint)
# #
# @version 1.1.0 # @version 1.1.1
# @since 08-26-2022 # @since 08-26-2022
# #
# @author Jérémi Nihart <contact@endmove.eu> # @author Jérémi Nihart <contact@endmove.eu>
@ -43,7 +43,7 @@ if ((DialogAsk "$ScriptName" "Do you want to continue and change the permission
# Retrieving users mailbox # Retrieving users mailbox
$Users = Get-EXOMailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object {$_.Alias -notin $IgnoreAlias} $Users = Get-EXOMailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object {$_.Alias -notin $IgnoreAlias}
$CountUsers = $Users.count $CountUsers = $Users.count
Write-Host ("[$ScriptName] We found $CountUsers users") -BackgroundColor White -ForegroundColor Black Write-Host ("[$ScriptName] We found $CountUsers user mailboxes") -BackgroundColor White -ForegroundColor Black
# Processing users mailbox list # Processing users mailbox list
# Info: all these loops are here because we want to follow up as we # Info: all these loops are here because we want to follow up as we
@ -57,7 +57,7 @@ foreach ($User in $Users) {
foreach ($Calandar in $Calandars) { foreach ($Calandar in $Calandars) {
Write-Host $Calandar.Name.ToString() -BackgroundColor DarkMagenta Write-Host $Calandar.Name.ToString() -BackgroundColor DarkMagenta
$CurrCalId = $User.Identity.ToString() + ":\" + $Calandar.Name.ToString() $CurrCalId = $User.Identity.ToString() + ":\" + $Calandar.Name.ToString()
$CurrCalPerms = Get-MailboxFolderPermission -Identity $CurrCalId | Where-Object {$_.Name -notin $IgnoreUsers -and $_.AccessRights -in $PermissionsTrigger} $CurrCalPerms = Get-EXOMailboxFolderPermission -Identity $CurrCalId | Where-Object {$_.Name -notin $IgnoreUsers -and $_.AccessRights -in $PermissionsTrigger}
$CountLocalUpdates = 0 $CountLocalUpdates = 0
# Nothing to change ? # Nothing to change ?

View File

@ -1,7 +1,7 @@
<## <##
# EXCAL-ARIGHTS - utilities function # EXCAL-ARIGHTS - utilities function
# #
# @version 1.1.0 # @version 1.1.1
# @since 08-26-2022 # @since 08-26-2022
# #
# @author Jérémi Nihart <contact@endmove.eu> # @author Jérémi Nihart <contact@endmove.eu>
@ -35,14 +35,14 @@ Function DisplayAll {
[string[]]$CalandarFolders [string[]]$CalandarFolders
) )
$Users = Get-EXOMailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox $Users = Get-EXOMailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox
Write-Host ("[$ScriptName] We found " + $Users.count + " users") -BackgroundColor White -ForegroundColor Black Write-Host ("[$ScriptName] We found " + $Users.count + " user mailboxes") -BackgroundColor White -ForegroundColor Black
foreach ($User in $Users) { foreach ($User in $Users) {
Write-Host $User.Name -BackgroundColor DarkGreen Write-Host $User.Name -BackgroundColor DarkGreen
$Calandars = Get-EXOMailboxFolderStatistics $User.Identity -FolderScope Calendar | Where-Object {$_.Name -in $CalandarFolders} $Calandars = Get-EXOMailboxFolderStatistics $User.Identity -FolderScope Calendar | Where-Object {$_.Name -in $CalandarFolders}
foreach ($Calandar in $Calandars) { foreach ($Calandar in $Calandars) {
Write-Host $Calandar.Name.ToString() -BackgroundColor DarkMagenta Write-Host $Calandar.Name.ToString() -BackgroundColor DarkMagenta
$CurrCalId = $User.Identity.ToString() + ":\" + $Calandar.Name.ToString() $CurrCalId = $User.Identity.ToString() + ":\" + $Calandar.Name.ToString()
$CurrCalPerms = Get-MailboxFolderPermission -Identity $CurrCalId $CurrCalPerms = Get-EXOMailboxFolderPermission -Identity $CurrCalId
foreach ($CurrCalPerm in $CurrCalPerms) { foreach ($CurrCalPerm in $CurrCalPerms) {
Write-Host ($CurrCalPerm.User.ToString() +" : " + $CurrCalPerm.AccessRights) Write-Host ($CurrCalPerm.User.ToString() +" : " + $CurrCalPerm.AccessRights)