ladda ActiveDirectory modulen till PS
Import-Module activedirectory
Get-ADGroupMember "GroupName" -Recursive | Select-Object name,samaccountname
exportera resultat till csv
Get-ADGroupMember "groupname" -Recursive | get-aduser | Select-Object name,samaccountname,enabled | export-csv outfile.csv -Encoding UTF8
eller...
get-adgroupmember -identity "domain admins" -Recursive | get-aduser -properties enabled,lastlogondate | Select-Object name,samaccountname,enabled,lastlogondate | export-csv DomainAdmins.csv -NoTypeInformation -Encoding utf8 -Delimiter ";"