As it says on the box. Export groups, members details
cls
$Groups =
Get-ADGroup -Properties * -Filter * -SearchBase
"OU=Groups,OU=name,DC=ic,DC=nsw,DC=gov,DC=au"
#get from the DN in AD Users and computers
Foreach($G
In $Groups)
{
Write-Host ""
Write-Host "-------------"
Write-Host "Group Name, SamAccountName, CanonnicalName, WhenCreated"
Write-Host $G.Name,"," $G.SamAccountName,","
$G.CanonnicalName,"," $G.WhenCreated,"," $G.LastLoginDate
#$G.Members
Write-Host ""
Write-Host "User SamAccountName, Name, CanonicalName, WhenCreated,
LastLoginDate"
Foreach($User In $G.Members)
{
$u= Get-ADUser $User -Properties *
Write-Host
$U.SamAccountName,"," $U.Name, "," $U.CanonicalName,
"," $U.WhenCreated, "," $U.LastLoginDate
}
}
No comments:
Post a Comment