I'm fairly new to powershell scripting, and to scripting in general, so this is probably a very easy question. Sorry if there's an answered question out there like this already.
My goal is to create a script that prompts you to enter an existing Active Directory username, and then reports back which users have "Send-As" rights from that Exchange mailbox.
(this part I need help with)
The first part of the script collects the DistinguishedName of the mailbox in question and sets it as variable $dn
$un = read-host "Enter Username"
$dn = $un????????????
(this part I already have figured out)
The second part uses the Get-ADPermission command to report back which users have "send-as" rights. The problem is, due to my organization's active directory structure, I have to use the DistinguishedName of an object for it to work, otherwise the command
errors.
Get-ADPermission -Identity $dn | ? {($_.ExtendedRights -like "*send-as*") -and -not ($_.User -like "*exchange*") | ft user,extendedrights
Any help would be appreciated! Thank you!
- Dan