winserverMany windows admins these days are very busy upgrading/replacing windows XP. I am not going to go into how very important to remove windows XP machines from our environments since it is now EOL and no patches will be released any longer. What I am going to show you is how to find all those windows XP machines in your active directory. Because clicking on every computer object and finding the OS installed on it is for the birds. No one has that kind of time to waste!

what we need is to do is open active directory power shell this should be located in control panel / administrative tools / Active Directory Module for Windows Power Shell
The following queries will output all the windows xp machines names and the date of their last logon. by default it will make c:\work\computers.csv if you do not have a folder named work you will need to create that yourself as PS does not create folders for you and you may receive errors if you try to write the file directly tot he c drive.

the last logon will help you identify unused computer accounts in your environment that can be removed safely from AD.

from that prompt use the following line

PS C:\Windows\system32> Get-ADComputer¬† -Filter * -Properties OperatingSystem,LastLogonDate | where {$_.OperatingSystem -match “Windows XP Professional”} | select Name, OperatingSystem, LastLogonDate | sort LastLogonDate -unique | Export-Csv c:\work\computers.csv

or if you want to refine your search to a certain OU you can use the following query just edit the ou and dc information to suit your needs.

PS C:\Windows\system32> Get-ADComputer -SearchBase ‘ou=Computers,dc=yourdomain,dc=com’ -Filter * -Properties OperatingSystem,LastLogonDate | where {$_.OperatingSystem -match “Windows XP Professional”} | select Name, OperatingSystem, LastLogonDate | sort LastLogonDate -unique | Export-Csv c:\work\computers.csv

By admin


Deprecated: Return type of Requests_Cookie_Jar::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Cookie/Jar.php on line 63

Deprecated: Return type of Requests_Cookie_Jar::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Cookie/Jar.php on line 73

Deprecated: Return type of Requests_Cookie_Jar::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Cookie/Jar.php on line 89

Deprecated: Return type of Requests_Cookie_Jar::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Cookie/Jar.php on line 102

Deprecated: Return type of Requests_Cookie_Jar::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Cookie/Jar.php on line 111

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 40

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 51

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 68

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 82

Deprecated: Return type of Requests_Utility_CaseInsensitiveDictionary::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/mcgeary/public_html/wp-includes/Requests/Utility/CaseInsensitiveDictionary.php on line 91