( AD ) Active Directory Powershell Commands

Get all users by last login

Get-ADUser -filter {enabled -eq $true} -Properties * | Select-Object Name, @{N='LastLogon'; E={[DateTime]::FromFileTime($_.LastLogon)}}|Sort-Object LastLogon -Descending
Get-ADUser -filter * -Properties "LastLogonDate" | select name, LastLogonDate

Get all users password expiration times

Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} -Properties "DisplayName", "msDS-UserPasswordExpiryTimeComputed"  |Select-Object -Property "Displayname",@{Name="ExpiryDate";Expression={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}}

Get one user by email

Get-ADUser -Identity "<username>" -Properties "LastLogonDate"

Better way to get all users and sort to make a file after propeties add what you want to display also put after select object

Get-ADUser -filter {enabled -eq $true} -Properties emailaddress,lastlogondate | Select-Object 	Name,emailaddress,lastlogondate 

Finding accounts that is locked, or disabled

Users on the domain is locked out

Search-ADAccount -Locked |Select Name, LockedOut, LastLogonDate

Users that has expired account

Search-ADAccount -AccountExpired

Users that has disabled account

Users that has inactive account

All inactive accounts

or

Users

Get when user is created

Get user count in hole of Domain

Get device count

Get count disabled users Count

Get count enabled users

Users that password that never expires count

What Users that password that never expires count

Get user last time he changed his password

Find when user changed their password last

Users after a month of not logging in

Users who clocked in within a month

Get when user accounts was created

Groups

Finding users who have not changed their password recently - Specops Software Get all users and their groups

Get all groups

Get groups that has no users

Find counts of members in all groups

Get when AD groups was created

Get filtered group name

Group members

Basic

Get group members by group name and select properties

Get group members by group scope

Get all group members

Get group members output grid

Devices

Get count of what operating system is on the network

Get device names for operating system

Get count for computers in searched filter

Get count of exact name of computers no wild cards

Last updated