A Pen by Trevor Bryant on CodePen.
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
# Get-LocalGroupMembers.ps1 | |
# Set variables | |
$Results = @() | |
$ComputerName = [ADSI]("WinNT://$env:COMPUTERNAME,computer") | |
$LocalGroups = $ComputerName.psbase.Children | Where-Object { | |
$_.psbase.schemaclassname -Eq "group" | |
} |
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
# Run on local Microsoft Windows endpoint and find all objects with Local Administrator rights | |
$ErrorActionPreference="SilentlyContinue" | |
#Credit to Sean Metcalf for this bit | |
$ADForestInfo = [System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest() | |
$ADForestInfoRootDomain = $ADForestInfo.RootDomain | |
$ADForestInfoRootDomainDN = "DC=" + $ADForestInfoRootDomain -Replace("\.",',DC=') | |
$ADDomainLDAPDN = 'GC://' + $ADForestInfoRootDomainDN | |
$root = [ADSI]$ADDomainLDAPDN |
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
### Keybase proof | |
I hereby claim: | |
* I am trevorbryant on github. | |
* I am trevorbryant (https://keybase.io/trevorbryant) on keybase. | |
* I have a public key ASBLUMBhLtBsA6Rl62X09nNiSTRjMkCTWympa7fjxUXXqgo | |
To claim this, I am signing this object: |
NewerOlder