[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

powershell add send as full access permissions

Posted on 2014-08-23
3
Medium Priority
?
772 Views
Last Modified: 2014-08-27
Guys thanks for your help so far. I got this code to check for existing permissions. If the permissions are not there looking for a snippet of code in powershell to add them

GC C:\Users.txt | %{
      New-object PSObject -Property @{
      User = $_
      SendAS =  [Bool](Get-MailboxPermission $_ | ?{$_.AccessRights -like "*FullAccess*" -and $_.User -like "NT AUTHORITY\SELF"})
      FullAccess = [Bool](Get-ADPermission $_ | ?{$_.ExtendedRights -like "*Send-As*" -and $_.User -like "NT AUTHORITY\SELF"})
      }
} | Export-Csv C:\report.csv -nti
0
Comment
Question by:techdrive
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 40281125
Updated code for automatically fixing the full mailbox and send as permission with some reporting. Check and let me know if you have any question regarding the code..
GC C:\Users.txt | %{
$user = $_
If (!(Get-MailboxPermission $user | ?{$_.AccessRights -like "*FullAccess*" -and $_.User -like "NT AUTHORITY\SELF"})) {
Try{
	ADD-MailboxPermission -Identity $user -User 'NT AUTHORITY\SELF' -InheritanceType 'All' -AccessRights 'FullAccess' -EA STOP | Out-Null
	$FullAccess = $true
	$Ffixed = "Fixed"
}Catch{
	$FullAccess = $False
	$Ffixed = "Not Fixed"
}
}Else{
	$FullAccess = $true
	$Ffixed = "UnChanged"
}
If (!(Get-ADPermission $user | ?{$_.ExtendedRights -like "*Send-As*" -and $_.User -like "NT AUTHORITY\SELF"})){
	Try {ADD-ADPermission -Identity $user -User 'NT AUTHORITY\SELF' -ExtendedRights 'send-as' -EA STOP | Out-Null
	$SendAS = $True
	$Sfixed = "Fixed"
}
Catch{
	$SendAS = $false
	$Sfixed = "Not Fixed"
}
}Else{
	$SendAS = $True
	$Sfixed = "UnChanged"
}
	New-object PSObject -Property @{
	User = $User
	SendAS = $SendAS
	SendASFixed = $SFixed
	FullAccess = $FullAccess
	FullAccessFixed = $FFixed
	}
} | Select User,SendAS,SendASFixed,FullAccess,FullAccessFixed |Export-Csv C:\report.csv -nti

Open in new window

0
 
LVL 40

Expert Comment

by:Subsun
ID: 40287642
If you don't have any further queries, Please don't forget to close the question.. :-)
0
 

Author Comment

by:techdrive
ID: 40288361
thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Suggested Courses

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question