ajout readme + début des tests
This commit is contained in:
parent
9e41fe51ca
commit
207657b5e8
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
|||||||
access_rights_update.log
|
*.log
|
43
README.md
43
README.md
@ -9,3 +9,46 @@
|
|||||||
|
|
||||||
## Description
|
## 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.
|
||||||
|
|
||||||
|
## Requierements
|
||||||
|
|
||||||
|
To use this script you need the following software and libraries. See the installation section for more information.
|
||||||
|
|
||||||
|
* Windows `>= v7` ;
|
||||||
|
* Windows ExecutionPolicy `== Unrestricted` (default status on windows) ;
|
||||||
|
* PowerShell `>= v5.2` ;
|
||||||
|
* PowerShell's `ExchangeOnlineManagement` module `>= v2.0.5` ;
|
||||||
|
* Administrator account on the Exchange server.
|
||||||
|
|
||||||
|
### 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).
|
||||||
|
|
||||||
|
```ps1
|
||||||
|
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
|
||||||
|
```
|
||||||
|
|
||||||
|
To install the powershell `ExchangeOnlineManagement` module execute the command below in Pshell.
|
||||||
|
|
||||||
|
```ps1
|
||||||
|
Install-Module -Name ExchangeOnlineManagement
|
||||||
|
```
|
||||||
|
|
||||||
|
Windows Policy Tips :
|
||||||
|
|
||||||
|
```ps1
|
||||||
|
Get-ExecutionPolicy # get the current policy
|
||||||
|
Get-ExecutionPolicy -List # get the current policies on the all device
|
||||||
|
|
||||||
|
Set-ExecutionPolicy Unrestricted # set the policy to unrestricted
|
||||||
|
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.
|
||||||
|
|
||||||
|
After the process you should find a log file with the process details.
|
@ -31,7 +31,7 @@ $IgnoreAlias = @("raoul.nihart", "brecht.marsoul")
|
|||||||
$AdminAccount = "admin@luminussolutions.be"
|
$AdminAccount = "admin@luminussolutions.be"
|
||||||
|
|
||||||
# Logs file in which log all process
|
# Logs file in which log all process
|
||||||
$LogFile = "access_rights_update.log"
|
$LogFile = "logs-$time.log"
|
||||||
|
|
||||||
# Script name
|
# Script name
|
||||||
$ScriptName = "EXCAL-ARIGHTS"
|
$ScriptName = "EXCAL-ARIGHTS"
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
# Setup script
|
# Setup script
|
||||||
$Root = (Split-Path $MyInvocation.MyCommand.Path -Parent)
|
$Root = (Split-Path $MyInvocation.MyCommand.Path -Parent)
|
||||||
|
$time = (Get-Date -Format "MM-dd-yyyy-HH-mm-ss")
|
||||||
. $Root\configs.ps1
|
. $Root\configs.ps1
|
||||||
. $Root\utils\functions.ps1
|
. $Root\utils\functions.ps1
|
||||||
Import-Module ExchangeOnlineManagement
|
Import-Module ExchangeOnlineManagement
|
||||||
@ -36,7 +37,7 @@ if ((DialogAsk "$ScriptName" "Do you want to continue and change the permission
|
|||||||
|
|
||||||
# Retrieving users mailbox
|
# Retrieving users mailbox
|
||||||
$Users = Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object {$_.Alias -notin $IgnoreAlias}
|
$Users = Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Where-Object {$_.Alias -notin $IgnoreAlias}
|
||||||
Write-Host ("We found " + $Users.count + " users`n") -BackgroundColor White -ForegroundColor Black
|
Write-Host ("[$ScriptName] We found " + $Users.count + " users`n") -BackgroundColor White -ForegroundColor Black
|
||||||
|
|
||||||
# Processing users mailbox list
|
# Processing users mailbox list
|
||||||
foreach ($User in $Users) {
|
foreach ($User in $Users) {
|
||||||
@ -48,7 +49,18 @@ foreach ($User in $Users) {
|
|||||||
$CurrCalId = $User.Identity.ToString() + ":\" + $Calandar.Name.ToString()
|
$CurrCalId = $User.Identity.ToString() + ":\" + $Calandar.Name.ToString()
|
||||||
$CurrCalPerm = Get-MailboxFolderPermission -Identity $CurrCalId -User Default
|
$CurrCalPerm = Get-MailboxFolderPermission -Identity $CurrCalId -User Default
|
||||||
|
|
||||||
|
# Check and update permission
|
||||||
|
if ($PermissionsTrigger -Contains $CurrCalPerm.AccessRights) {
|
||||||
|
Write-Host " [X] " -NoNewline
|
||||||
|
Write-Host ("Updated : The permission has been updated from (" + $CurrCalPerm.AccessRights + ") to (" + $Permission + ").") -ForegroundColor Green
|
||||||
|
$CountOK++
|
||||||
|
# Update permission
|
||||||
|
Set-MailboxFolderPermission -Identity $CurrCalId -User Default -AccessRights $Permission -WhatIf
|
||||||
|
} else {
|
||||||
|
Write-Host " [X] " -NoNewline
|
||||||
|
Write-Host ("Ignored : The permission (" + $CurrCalPerm.AccessRights + ") of this user did not launch the trigger.") -ForegroundColor Yellow
|
||||||
|
$CountUpdated++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
@ -1,20 +1,4 @@
|
|||||||
Get-ExecutionPolicy
|
Get-ExecutionPolicy
|
||||||
|
|
||||||
Set-ExecutionPolicy Unrestricted
|
Set-ExecutionPolicy Unrestricted
|
||||||
Set-ExecutionPolicy Restricted
|
Set-ExecutionPolicy Restricted
|
||||||
|
|
||||||
Install powershell 7 from powershell 5 :
|
|
||||||
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($u in $users)
|
|
||||||
{
|
|
||||||
Write-Host $u.Name -ForegroundColor Green
|
|
||||||
$cal = Get-MailboxFolderStatistics $u.Identity -FolderScope Calendar | Where-Object {$_.Name -in @("Agenda", "Calendar", "Calendrier", "Kalender")}
|
|
||||||
|
|
||||||
foreach ($c in $cal)
|
|
||||||
{
|
|
||||||
Write-Output $c.Name
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user