PowerShell : Get membership info for a computer Object.
File Format :
$Computers=
Get-Content C:\Temp\ADComputer.txt
$output = foreach($Computer
in $Computers)
{
$groups = Get-ADPrincipalGroupMembership
(Get-ADComputer $Computer)
| select-object
name
foreach($group in $groups)
{
[PSCustomObject]@{
ComputerName = $Computer
Group =
$group.Name
}
}
}
No comments:
Post a Comment