Skip to content

Instantly share code, notes, and snippets.

@bill-long
Created March 21, 2016 23:58
Show Gist options
  • Save bill-long/0e5f62a9cdc5f9a7fc8b to your computer and use it in GitHub Desktop.
Save bill-long/0e5f62a9cdc5f9a7fc8b to your computer and use it in GitHub Desktop.
Dump msExchMailboxSecurityDescriptor as SDDL format. Useful if you need to inspect the raw ACL.
param($alias)
$searcher = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().FindGlobalCatalog().GetDirectorySearcher()
$searcher.Filter = "(mailnickname=$alias)"
$user = $searcher.FindOne()
$mbxSd = $user.Properties["msExchMailboxSecurityDescriptor"][0]
$sd = New-Object System.Security.AccessControl.RawSecurityDescriptor([byte[]]$mbxSd, 0)
$sd.GetSddlForm("All")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment