Click here to Skip to main content
15,881,938 members
Articles / Programming Languages / PowerShell
Tip/Trick

PowerShellScript to Unify AccessRights of Mailboxes

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
25 Aug 2013GPL31 min read 5.4K   28   2  
PowerShellScript to Unify AccessRights of Mailboxes

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.

Image 1

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.

C++
{
     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]
		}
},   
.....
..... 

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer
Finland Finland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --