Get List of Users AD Password Expiration with Powershell

Just a couple good Powershell scripts for getting AD user password expirations.

List all users password expiration date (one-liner)

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

You can change the Out-GridView cmdlet at the end to export-csv or

How to Disable Focused Inbox in Office 365

Starting April 2017, Microsoft is rolling out a replacement for the Clutter folder in Outlook. This replacement is called the Focused Inbox. If you want to know a bit more, a couple Microsoft articles can be found here and here.

If you're like me and would rather not have this feature, here's how to turn it off:

Disable Focused Inbox for your whole organization

  • Connect to Exchange Online via Powershell (more info)
  • Run Set-OrganizationConfig -FocusedInboxOn

How to Remove Home Folder Mapping for all AD Users

With so many businesses adopting Microsoft Office 365 or Google Apps for Work, users are now able to put more of their files in the cloud - thus replacing on-site server storage and user home directories. The below Powershell script will remove all user home folder mappings in Active Directory:

Get-AdUser -Filter * -Properties * | Foreach {
   Write-Host "- " $_.Name
   if ($_.HomeDrive -ne $null) {
    Write-Host -NoNewline "|-  Current home:" $_.HomeDrive "->"