2022-08-25 17:27:45 +02:00
|
|
|
<##
|
|
|
|
# EXCAL-ARIGHTS - utilities function
|
|
|
|
#
|
2022-08-26 09:48:05 +02:00
|
|
|
# @version 1.1.0
|
|
|
|
# @since 08-26-2022
|
2022-08-25 17:27:45 +02:00
|
|
|
#
|
|
|
|
# @author Jérémi Nihart <contact@endmove.eu>
|
|
|
|
# @copyright © 2022 EndMove, All rights reserved.
|
|
|
|
#
|
|
|
|
# @link https://git.endmove.eu/EndMove/excal-arights
|
|
|
|
#>
|
|
|
|
|
|
|
|
# Show a question dialog (yes/no)
|
|
|
|
Function DialogAsk {
|
|
|
|
param (
|
|
|
|
[string]$Title,
|
|
|
|
[string]$Message
|
|
|
|
)
|
|
|
|
$MsgBoxInput = [System.Windows.MessageBox]::Show($Message, $Title, 'YesNo', 'Question')
|
|
|
|
if ($MsgBoxInput -eq 'Yes') {Return $true} else {Return $false}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Show an information dialog
|
|
|
|
Function DialogSay {
|
|
|
|
param (
|
|
|
|
[string]$Title,
|
|
|
|
[string]$Message
|
|
|
|
)
|
|
|
|
[System.Windows.MessageBox]::Show($Message, $Title, 'OK', 'Information')
|
2022-08-25 23:26:12 +02:00
|
|
|
}
|
|
|
|
|
2022-08-26 09:48:05 +02:00
|
|
|
# Show current permissions for all user's calandars
|
2022-08-25 23:26:12 +02:00
|
|
|
Function DisplayAll {
|
|
|
|
param (
|
|
|
|
[string[]]$CalandarFolders
|
|
|
|
)
|
|
|
|
$Users = Get-EXOMailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox
|
|
|
|
Write-Host ("[$ScriptName] We found " + $Users.count + " users") -BackgroundColor White -ForegroundColor Black
|
|
|
|
foreach ($User in $Users) {
|
|
|
|
Write-Host $User.Name -BackgroundColor DarkGreen
|
|
|
|
$Calandars = Get-EXOMailboxFolderStatistics $User.Identity -FolderScope Calendar | Where-Object {$_.Name -in $CalandarFolders}
|
|
|
|
foreach ($Calandar in $Calandars) {
|
|
|
|
Write-Host $Calandar.Name.ToString() -BackgroundColor DarkMagenta
|
|
|
|
$CurrCalId = $User.Identity.ToString() + ":\" + $Calandar.Name.ToString()
|
|
|
|
$CurrCalPerms = Get-MailboxFolderPermission -Identity $CurrCalId
|
|
|
|
|
|
|
|
foreach ($CurrCalPerm in $CurrCalPerms) {
|
|
|
|
Write-Host ($CurrCalPerm.User.ToString() +" : " + $CurrCalPerm.AccessRights)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Write-Host
|
|
|
|
}
|
2022-08-25 17:27:45 +02:00
|
|
|
}
|