Windows Server 2003 will reach its end-of-life by July 2015, here's a simple way to identity live windows 2003 servers in your domain:

##needs import-module ActiveDirectory

$ErrorActionPreference = "Stop"

 

Get-ADComputer -Filter * -Property OperatingSystemVersion,Name | where {$_.OperatingSystemVersion -like "*5.2*"} | select-object Name | export-csv -delimiter "`t" -path c:\scripts\2003sq.txt

 

get-content c:\scripts\2003sq.txt |

select-string -pattern 'Name' -notmatch |

select-string -pattern '----' -notmatch |

select-string -pattern '#TYPE Selected.Microsoft.ActiveDirectory.Management.ADComputer' -notmatch |

% {$_ -replace '"', ""} |

out-file c:\scripts\2003s.txt

 

$2003 = get-content c:\scripts\2003s.txt

 

foreach ($comp in $2003)

{

 

try

{

test-connection -ComputerName $comp -count 1

}

 

catch

{

"$comp appears inactive"

}

 

}