Skip to content

Instantly share code, notes, and snippets.

@ykfq
Forked from bill-long/Dump-MailboxSdAsSDDL.ps1
Created August 9, 2016 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ykfq/9a0f45ceba2ef2f9f23af99bc0cf50e2 to your computer and use it in GitHub Desktop.
Save ykfq/9a0f45ceba2ef2f9f23af99bc0cf50e2 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