Cloturation développement version 1.1.0

This commit is contained in:
Jérémi N ‘EndMove’ 2022-08-26 09:48:05 +02:00
parent 2e4b8a4525
commit acb5cfaf64
Signed by: EndMove
GPG Key ID: 65C4A02E1F5371A4
4 changed files with 131 additions and 18 deletions

120
README.md
View File

@ -7,11 +7,13 @@
[link-icon-website]: https://img.shields.io/badge/%F0%9F%92%BB-My%20Web%20Site-0078D4.svg
[link-website]: https://www.endmove.eu/
__Current version : *1.0.0*__
__Current version : *1.1.0*__
## Description
ExCal-ARights is a script to automate the change of permissions on Microsoft Exchange Server calendars. This script allows you to define a list of aliases to ignore, as well as different triggers (permissions triggering a change) and the permission to use. Moreover, any action performed by the ExCal-ARights is logged so that you can confirm and view the changes after application.
ExCal-ARights is a script to automate the change of permissions on Microsoft Exchange Server calendars. This script allows you to define your own configuration (see [Use->Configuration](#configuration)). Moreover, any action performed by ExCal-ARights is recorded so that you can confirm and view the changes after application.
You can also choose to quit the script before starting the change of permissions. As well as previewing the permissions of all calendars before and after the change. The permissions preview does not consider the configuration filters, it previews all users.
## Requierements
@ -25,9 +27,7 @@ To use this script you need the following software and libraries. See the instal
### Installation
To install Windows 11 see the requirement at https://www.microsoft.com/en-us/windows/windows-11-specifications (check minimum version above).
To install powershell 7 use the command below in your Pshell (check minimum version above).
To install Windows 11 see the requirement at https://www.microsoft.com/en-us/windows/windows-11-specifications (check minimum version above). To install powershell 7 use the command below in your Pshell (check minimum version above).
```ps1
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
@ -51,6 +51,112 @@ Set-ExecutionPolicy Restricted # set the policy to restricted
## Use
Clone or download and extract this repository from its archive. Open the `configs.ps1` script and configure it. Then run the `run-script.ps1` file and follow the indications.
Clone or download and extract this repository from its archive. Open the `configs.ps1` script and configure it. Then run the `run-script.ps1` file and follow the indications.
After the process you should find a log file with the process details.
After the process you should find a log file with the process details.
### Exchange Server Structure
Regardons ici à quoi resemble la structure d'un server Exchange au niveau de la répartition des dossiers et permissions d'accès par utilisateur.
1. Is the first level and represents a user. ```[*1]```
2. Is the second level and represents a folder in our case a calendar. This level can contain several items (folders). ```[*2]```
3. Is the third level and represents the authorizations assigned to a specific user to the folder by the 1st level owner user. ```[*3]```
* "**Default**" user represents the authorizations for all persons for which the authorizations have not been defined manually.
* "**Anonymous**" user should have *None* permission (authorizations for anyone outside the organization).
```
Exchange_Server:
├───User-1 [*1]
│ └───Calandar [*2]
│ ├───Default [*3]
│ └───Anonymous
├───User-2
│ └───Agenda
│ ├───Default
│ ├───Anonymous
│ └───User-3
└───User-3
├───Agenda-2
│ ├───Default
│ ├───Anonymous
│ └───User-1
└───Calandar
├───Default
├───Anonymous
├───User-1
├───User-2
└───User-3
```
### Configuration
#### New permission
This variable allows you to configure the permission that will replace the current permission (if the current permission fires the trigger). You can find [here](https://docs.microsoft.com/en-us/powershell/module/exchange/set-mailboxfolderpermission?view=exchange-ps#parameters) the list of permissions on the Microsoft website.
```ps1
$Permission = "Reviewer"
```
#### Trigger permission
This variable is used to define the list of permissions that should be changed. We call this list of permissions the list of triggers.
```ps1
$PermissionsTrigger = @("LimitedDetails", "AvailabilityOnly")
```
#### Folder to process
This variable defines the list of caller names to be processed. If a user has more than one calendar in this list, all calendars in the list will be impacted.
In the structure we are on the ``*2nd`` level.
```ps1
$CalandarFolders = @("Agenda", "Calendar", "Calendrier", "Kalender")
```
#### User to exclude
This variable defines a list of email aliases of users whose calendars should be ignored (in short, the calendars of these people will not be checked or processed). An alias is that part of the email address (``contact``@endmove.eu).
In the structure we are at the ``*1st`` level.
```ps1
$IgnoreAlias = @("jeremi.nihart", "contact.endmove")
```
#### Permission of user to skip
This variable defines a list of user names whose authorizations that the 1st level users have defined in their own calendars must be ignored.
In the structure we are on the ``*3rd`` level.
```ps1
$IgnoreUsers = @("Anonymous", "Nihart Jérémi", "Jone Michel")
```
#### Admin Exchange account
This variable defines the email of an administrator account with edit and write permissions on the Microsoft Exchange server.
```ps1
$AdminAccount = "admin@endmove.eu"
```
#### Logs file name
This variable defines the name of the log file. The `$Time` variable contains the complete date and time.
```ps1
$LogFile = "logs-$time.log"
```
#### Script name
This variable is used to define the name of the script, in our case ExCal-ARights.
```ps1
$ScriptName = "EXCAL-ARIGHTS"
```

View File

@ -1,8 +1,8 @@
<##
# EXCAL-ARIGHTS - configuration file
#
# @version 1.0.0
# @since 08-25-2022
# @version 1.1.0
# @since 08-26-2022
#
# @author Jérémi Nihart <contact@endmove.eu>
# @copyright © 2022 EndMove, All rights reserved.
@ -34,7 +34,7 @@ $IgnoreUsers = @("Anonymous")
$AdminAccount = "admin@luminussolutions.be"
# Logs file in which log all process
$LogFile = "logs-$time.log"
$LogFile = "logs-$Time.log"
# Script name
$ScriptName = "EXCAL-ARIGHTS"

View File

@ -1,8 +1,8 @@
<##
# EXCAL-ARIGHTS - runable script (entrypoint)
#
# @version 1.0.0
# @since 08-25-2022
# @version 1.1.0
# @since 08-26-2022
#
# @author Jérémi Nihart <contact@endmove.eu>
# @copyright © 2022 EndMove, All rights reserved.
@ -30,12 +30,12 @@ $CountErrors = 0
Connect-ExchangeOnline -UserPrincipalName $AdminAccount -ShowProgress $true
# Do you want to preview current permissions ?
if ((DialogAsk "$ScriptName" "Do you want to preview all calandar permissions ?") -eq $true) {
if ((DialogAsk "$ScriptName" "Do you want to preview all calandar permissions ?`nThis action may take more than 5 minutes.") -eq $true) {
DisplayAll $CalandarFolders
}
# Do you realy want to change permissions ?
if ((DialogAsk "$ScriptName" "Do you want to continue and change the permission of the calendars according to your current configuration?") -eq $false) {
if ((DialogAsk "$ScriptName" "Do you want to continue and change the permission of the calendars according to your current configuration?`nIf no script will be aborted.") -eq $false) {
Stop-Transcript
Exit
}
@ -69,7 +69,7 @@ foreach ($User in $Users) {
foreach ($CurrCalPerm in $CurrCalPerms) {
Write-Host (" UPDATE --> Permission for " + $CurrCalPerm.User.ToString() + " has been switch from " + $CurrCalPerm.AccessRights + " to " + $Permission + ".") -ForegroundColor Green
# Update permission (for debugging: -WhatIf)
Set-MailboxFolderPermission -Identity $CurrCalId -User $CurrCalPerm.User.ToString() -AccessRights $Permission -WhatIf
Set-MailboxFolderPermission -Identity $CurrCalId -User $CurrCalPerm.User.ToString() -AccessRights $Permission
$CountLocalUpdates++
}
}
@ -87,5 +87,12 @@ foreach ($User in $Users) {
# Showing resultats
DialogSay "$ScriptName" "The update was performed successfuly.`n`n$CountUpdates has been updated on $CountUsers`n$CountErrors errors occured."
# Do you want to view the new permissions ?
if ((DialogAsk "$ScriptName" "Do you want to view all new permission ?`nThis action may take more than 5 minutes.") -eq $true) {
DisplayAll $CalandarFolders
}
Read-Host "The script has finished, press ENTER to continue..."
# Stop logging
Stop-Transcript

View File

@ -1,8 +1,8 @@
<##
# EXCAL-ARIGHTS - utilities function
#
# @version 1.0.0
# @since 08-25-2022
# @version 1.1.0
# @since 08-26-2022
#
# @author Jérémi Nihart <contact@endmove.eu>
# @copyright © 2022 EndMove, All rights reserved.
@ -29,7 +29,7 @@ Function DialogSay {
[System.Windows.MessageBox]::Show($Message, $Title, 'OK', 'Information')
}
# Show current permissions for all calandars and users
# Show current permissions for all user's calandars
Function DisplayAll {
param (
[string[]]$CalandarFolders