Thursday, September 27, 2012

Create an Import Export Management Group with rights

To be able to use the other script to import PST Files, you first must have the permission to do so.

Since I am in favor of RBAC I created a little script to create an Exchange Import and Export Management Group, add the current user to this group and assign the appropriate rights to the group.

# To be able to import PST files you must be member of the Import Export Management Role.
# Bas Steelooper, XOBIT IT Services
# 
# This script will create an AD Group in the users OU named Exchange-ImportExport-Management
# And add the current user to this group.
# You have to logoff and logon again to use the newly acquired rights

# Configure here the name of the group to create
$GroupName = "Exchange-ImportExport-Management"

#============================
# Do not edit below this line
#============================

#Prepare the needed modules
Import-Module ActiveDirectory
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

# Create the AD Group as a Universal Group
New-ADgroup -Name $GroupName -GroupScope 2

# Add the current logged on user to the Group
Add-ADGroupMember -Identity $GroupName $env:username

# Assign the Import Export Rights to the Group
New-ManagementRoleAssignment -Name "ImportExport-Management" -SecurityGroup $GroupName -Role "Mailbox Import Export"


No comments:

Post a Comment