RKL eSolutions Blog

Windows XP End of Life: Use PowerShell to Find Remaining Windows XP Machines

Written by RKL Team | Mar 17, 2014 7:24:18 PM

Are you ready for Windows XP End of Life?  With April 8th, 2014 rapidly approaching you might find yourself scratching your head wondering how many Windows XP computers are in your environment that need to be replaced or upgraded. There are various tools you can use that do the reporting such as Symantec Endpoint Protection Management Console or even Spiceworks if you have it deployed in your network. I developed a simple one line script in PowerShell that can report this and export the information to a CSV file. All you need is at least one Microsoft Windows Server 2008 R2 domain controller or above to be able to run Remote Active Directory Administration commands against and of course the client RSAT tools for your workstation if that's where you choose to run the command from.

In this example we'll be running the command directly from a Server 2008 R2 domain controller.

  1. Open your PowerShell window and run the following command (run with highest privilege): Import-Module ActiveDirectory OR just run the Active Directory Module for Windows PowerShell
  2. Once the Active Directory module is finished importing, execute the following command: Get-ADComputer -Filter * -Properties OperatingSystem,LastLogonDate | where {$_.OperatingSystem -match "Windows XP Professional"} | select Name, OperatingSystem, LastLogonDate | sort LastLogonDate –unique | Export-Csv c:workcomputers.csv

This command will go through all of Active Directory to scout out the computer objects and then extracts the standard properties plus the OperatingSystem and LastLogonDate attributes. It then filters the list of computers based on having Windows XP Professional as the listed OS and sorts by LastLogonDate. This should give you a pretty good idea as to how many active Windows XP machines you have in your network. If you don't want the CSV file just remove the Export-CSV statement from the command.

Hopefully you find this as useful as I did!