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 format-table if you want output to cmd.

Export all users expiring in next 7 days

Get-ADUser

How to Split a Spreadsheet into Multiple Sheets or Workbooks based on Column Value

Dealing with data (as in statistics, not storage) is a daily job of sysadmins. I love CSV exports but often times I need to separate the data out by a certain column or split into multiple workbooks/files to send to other staff. For instance, there are 22 branch offices where I work and getting the appropriate data to each building from one spreadsheet used to be a daunting task.

The first macro below (SplitToWorksheets)

Using SAMAccountName to Login to ADFS in Windows Server 2012R2/2016

When setting up Active Directory Federation Services (ADFS), by default it requires that users log in using their User Principal Name (UPN) or using DOMAIN\username. However this can be confusing to users, especially when you're in a single domain environment.

It took me way longer than it should have to figure out how to accomplish this. Hopefully this will help some folks find some more recent info than all the ADFS 2.0 stuff

Migrating/Restoring a Filewave Server Backup (Linux)

NOTE: These instructions are current as of Filewave 11.2.2 on CentOS

1) Install the same version of Filewave on the new/rebuilt server

2) Stop the Filewave service:
sudo fwcontrol server stop

3) Copy the backup files to the new server (via SCP or SFTP)

4) Move the Data Folder to the corresponding directory:
mv /path/to/old/Data\ Folder /fwxserver/

5) Start the postgres process:
sudo -u postgres /usr/local/filewave/postgresql/

Posted on
Tagged in filewave

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 Reverse/Mirror Contents of Cell in Excel

This may seem like a weird topic to discuss but I've always found Excel to be highly useful in manipulating data and can often be quicker than writing one-off scripts.

One of the most used features is the Text-to-Columns button (found in the Data ribbon of Excel), which splits tab and comma delimited files into individual columns. But sometimes the values may not all have the same number of columns. For instance, let's look at

How to Enable Serial Console Output in CentOS

In our environment, we have a few caching servers that are distributed across branch offices. These branch offices usually lack a KVM - which means tracking down a monitor, keyboard, mouse, etc. What a pain! If only we could simply hook up a serial cable and use Putty - oh wait we can!

  1. Let's open up our text editor: nano /etc/sysconfig/grub
  2. Find the line labeled GRUB_CMDLINE_LINUX and add console=ttyS0 to
Posted on
Tagged in centos , linux

Fixing Exchange 2010 WinRM MaxEnvelopeSize Exceeded Error

Once upon a time, I was trying to make a change to the allowed sender IP address list on our Exchange 2010 server. However every time I tried to add or remove an IP address, I received an error that looked very much like one of the below messages:

  • The WinRM client sent a request to the remote WS-Management service and was notified that the request size exceeded the configured MaxEnvelopeSize quota
  • The response that

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 "->" $_.HomeDirectory": removing... "
    Set-AdUser -Identity $_.DistinguishedName -HomeDirectory

Automatically Pull Old Computer Name with MDT Task Sequence

One of the biggest slowdowns when reimaging an entire lab of computers is the naming process in MDT. Of course, you could simply do a refresh deployment but often you just want to completely wipe everything on the machine and start fresh but also keep the same computer name.

This can easily be done using a UserExit.vbs script in just a couple steps.

  1. Open up your MDT deployment share and add the following two
Posted on
Tagged in windows , mdt