Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$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
You can’t perform that action at this time.