Windows AD commands + server cheat sheet

gpupdate /force - update the GP objects for computer

gpresult /Scope User /v - show applied GP object groups, user details etc. for user 

gpresult /Scope Computer /v - - show applied GP object groups, user details etc. for computer

rsop.msc - gui for appolied GP

repadmin /replsummary - replication summary


Check running services(Power shell):
$Services='DNS','DFS Replication','Intersite Messaging','Kerberos Key Distribution Center','NetLogon',’Active Directory Domain Services’
ForEach ($Service in $Services) {Get-Service $Service | Select-Object Name, Status}

Test AD DNS:
DCDiag /Test:DNS /e /v

Test AD:
DCDiag /e 
DCDiag /e /v - verbose

Get roles(Power shell):
get-addomain
Activate windows server evaluation version

DISM /online /Set-Edition:ServerStandard /ProductKey:N69G4-B89J2–4G8F4-XXXXX-XXXXX /AcceptEula



Find inactive users in AD

Import-Module ActiveDirectory  
  
$DaysInactive = 180  
$Time = (Get-Date).Adddays( - ($DaysInactive))  
  
Get-ADUser -Filter { LastLogonTimeStamp -lt $Time -and enabled -eq $true } -Properties * |  
Select-Object Name, LastLogonDate |  
  
Export-Csv "c:\Export\InactiveUsers.csv" -Encoding UTF8 -NoTypeInformation