Skip to content

Instantly share code, notes, and snippets.

@rodmhgl
Created November 28, 2017 19:16
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 rodmhgl/b86fb5ed57e121ecd9b520c0d2ff3368 to your computer and use it in GitHub Desktop.
Save rodmhgl/b86fb5ed57e121ecd9b520c0d2ff3368 to your computer and use it in GitHub Desktop.
$NetBiosName = "DOMAIN"
(Get-Acl c:\temp).Access |
Where-Object {
($_.IdentityReference -split '\\') -eq $NetBiosName
} |
ForEach-Object {
$SAMAccountName = ($_.IdentityReference -split '\\')[1]
$Class =( Get-ADObject -Filter {Samaccountname -eq $SAMAccountName}).objectclass
switch ($Class) {
"user" { "Object is a user" }
"group" { "Object is a group"}
Default { "Object is building a mystery"}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment