Last active
July 20, 2017 16:17
-
-
Save josephkern/58e1bc43202632a9488672d343a58162 to your computer and use it in GitHub Desktop.
Recursively enumerate nested groups in AD
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
function getgroups ($object) { | |
### Example: getgroups -object somename.lastname | select name -unique | |
Get-ADPrincipalGroupMembership $object | Foreach { | |
$_ | |
Get-ADPrincipalGroupMembership $_ | |
} | |
} | |
function GetPortsandPrinters { | |
$printers = Get-Printer | |
foreach ($port in $(Get-PrinterPort)) { | |
$printers | ? { $_.PortName -like $port.Name } | select Name, | |
@{Name = 'Port Name'; Expression = {$port.Name}}, | |
@{Name = 'Host Address'; Expression = {$port.PrinterHostAddress}} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment