Home | Site Map | Cisco How ToNet How To | Wireless |Search | Forums | Services | Donations | Careers | About Us | Contact Us|

Getting Active Directory Users Data using Powershell

Active Directory, Domain, DNS, WINS, DHCP, SBS, New Releases.

Getting Active Directory Users Data using Powershell

Postby blin » Fri Jul 29, 2016 4:47 pm

You can use Get-ADUser powershell command to get Active Directory Users information. Her eare some examples.

1. Get-ADUser -Filter {Enabled -eq "True"} | Select-Object SamAccountName,Name,Surname,GivenName | Format-Table to get active user accounts.

2. Get-ADUser -Filter {Enabled -eq "false"} | Select-Object SamAccountName,Name,Surname,GivenName | Format-Table to get disabled user accounts.

3. Get-ADUser -Filter {SamAccountName -like "*"} >c:\temp\users.txt to export all user accounts information to c drive temp folder.

4. Get-ADUser -identity user1 -properties * to get user account user1 information.

5. Get-ADUser -filter * -properties PasswordExpired, PasswordLastSet, PasswordNeverExpires | ft Name, PasswordExpired, PasswordLastSet, PasswordNeverExpires to get the information about the date of the last password change, the time of its expiration, and never expire.

6. Get-ADUser -SearchBase ‘OU=users,DC=hsapayroll,DC=com’ to display the data of the users from a certain OU, Users in our example.

7. Get-ADUser -filter {name -like "Bob*"} to Display an AD user named Bob.

8. Get-ADUser -Filter {SamAccountName -like "*"} | Measure-Object to calculate the total number of all Active directory accounts

9. Get-ADUser -filter {Enabled -eq $True} -properties passwordExpired | where {$_.PasswordExpired} to display all active the accounts with the expired password
How to Configure and Troubleshoot Cisco
http://www.howtocisco.com

Tablet and Smartphone Setup Guide
http://www.quicksetupguide.com
blin
Site Admin
 
Posts: 3594
Joined: Wed Dec 31, 1969 7:00 pm
Location: Chicago, USA

Re: Getting Active Directory Users Data using Powershell

Postby blin » Fri Jul 29, 2016 5:11 pm

To display users who haven’t changed their passwords in the last 30 days

$30_Days = (Get-Date).adddays(-30)

Get-ADUser -filter {(passwordlastset -le $30_days)}
How to Configure and Troubleshoot Cisco
http://www.howtocisco.com

Tablet and Smartphone Setup Guide
http://www.quicksetupguide.com
blin
Site Admin
 
Posts: 3594
Joined: Wed Dec 31, 1969 7:00 pm
Location: Chicago, USA


Return to Windows

Your Ad Here

Who is online

Users browsing this forum: No registered users and 5 guests