cj_cb
asked on
Powershell AD query script needed
Need a powershell script to get these fields and save to csv.
Username
Group membership
Last login
Display name
OU
Enabled/disabled
Username
Group membership
Last login
Display name
OU
Enabled/disabled
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then we can use the ActiveDirectory module, and the Get-AD* cmdlets ...
ASKER
that may work, was hoping for a little more detail on how to use the cmdlet.
Sorry, I wasn't finished, but had to leave.
Something like this?
Something like this?
Import-Module ActiveDirectory
Get-ADUser -Filter * -Properties * |
select Name,
@{n='Group Membership'; e={($_.MemberOf | % {(get-adgroup $_).Name}) -join ','}},
LastLogonDate, DisplayName, DistinguishedName, Enabled |
Export-CSV 'C:\Results.csv'
ASKER