Skip to main content

Powershell: Get-ADUser

# Users last logon more than 180 days

PS C:\Windows\system32>Import-Module ActiveDirectory

PS C:\Windows\system32>$today = Get-Date -Format yyyyMMdd

PS C:\Windows\system32>$date = (Get-Date).AddDays(-180)

PS C:\Windows\system32> Get-ADUser -Filter {LastLogonDate -lt $date} -Properties * | Select Name,SamAccountName,Office,LastLogonDate | Sort-Object Office | Export-Csv -Path C:\Audit\last-logon-180-days-$today.csv -NoTypeInformation


Popular posts from this blog

Fedora Workstation: Install snapd

[tuyen@g73jh ~]$ sudo dnf -y install snapd Last metadata expiration check: 0:20:17 ago on Tue 01 Oct 2019 11:31:30 AM +07. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: snapd x86_64 2.41-1.fc30 updates 17 M Installing dependencies: snap-confine x86_64 2.41-1.fc30 updates 2.8 M snapd-glib x86_64 1.49-1.fc30 updates 133 k snapd-selinux noarch 2.41-1.fc30 updates 234 k Installing weak dependencies: gnome-software-snap x86_64 3.32.4-2.fc30 updates 86 k Transaction Summary ================================================================================ Install 5 Packages Total download size...

Windows 10: Install SuSE Linux Enterprise - SLES

With Microsoft-Windows-Subsystem-Linux feature enabled, we can install Linux distributions on Windows 10.

Java: error - could not find or load main class

Java Error: Could not find or load main class Java: Common mistake of beginners