As an example, the following command will find all computers in Active Directory that have not been logged into during the past 8 weeks:
dsquery computer -inactive 8 -limit 0
After reviewing this list to make sure these computers no longer exist on your network you can use the following command to find and delete them:
dsquery computer -inactive 8 -limit 0 | dsrm
The DSQUERY utility comes with the Windows Server 2003 Support Tools package (Adminpak.msi) which can be installed directly from your Windows Server 2003 installation media or downloaded from the Microsoft website.