Introduction
This is a PowerShell-Script that can be used to unify mailbox-level AccessRights of two of or more mailboxes. Inputs are given in graphical user interface that the script creates based on configuration written on JSON-file.
This script works on Exchange Server 2013.
In GUI, multiline inputbox is used to give one or more mailbox identifiers that are used to find mailboxes that access rights are to be changed. Singleline inputbox is used to give mailbox identifier that is used to find mailbox that access rights are to be used when changing rights of other mailboxes to be alike.
Using the Code
There are three different functions that are used in code: GetAccess
, Change_Rights
, make_settings
.
GetAccess
Returns AccessRights
of single mailbox in this format: "User|AccessRight". Return value is used when changing AccessRights
mailboxes.
Change_Rights
This function is responsible for unifying rights of two mailboxes. This is achieved by making necessary additions and removals of rights so that rights of two mailboxes whose identifiers were given as input are similar.
make_settings
make_settings
-function creates single GUI-component and makes settings for it. Uses JSON-file for this process.
JSON-file
Each JSON-file object-represents one GUI-component. These objects have properties that have information relating to component such as from which .NET-class component will be build and what is its size and location.
First object is reserved for forms-class and object's components array holds objects that have information related to buttons, inputs, etc. that are to be added to form.
{
Class:"System.Windows.Forms.Form",
Name:"Form",
text:"Change AccessRigths",
StartPosition : "CenterScreen",
Topmost : "true",
Size: {
Class:"System.Drawing.Size",
Parameters:[411,346]
},
Components: [
{
Class:"System.Windows.Forms.Button",
name:"Button",
Text:"Execute",
Location: {
Class:"System.Drawing.Size",
Parameters:[149,248]
},
Size: {
Class:"System.Drawing.Size",
Parameters:[93,34]
}
},
.....
.....