Created
November 28, 2017 19:16
-
-
Save rodmhgl/b86fb5ed57e121ecd9b520c0d2ff3368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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