Starting today, Microsoft has stopped supporting Windows Server 2003. Just received a request two days ago to find 2003 of the server: from SCCM can not find all, some servers do not have SCCM agent, I hope from AD to find. This article writes out all my practices for everyone to share.
All work is expanded around the Get-adcomputer command, filtering the OperatingSystem properties.
Export all 2003 machines into the All2003.csv file:
Get-adcomputer-filter {operatingsystem-like "*2003*"}-properties * | Export-csv. \all2003.csv–notypeinformation
The command is very simple and does not require much explanation. If you are a small domain environment, this command is sufficient.
And we are dozens of sites, dozens of branches of the domain, only ask for a site or branch of the 2003 server is a little more complicated.
If your server has a good naming convention, the name can reflect the company, such as the company name in Beijing contains CNBJ, you can add a search criteria to check:
Get-adcomputer-filter {(operatingsystem-like "*2003*")-and (name-like "*cnbj*")}-properties * | Export-csv. \cnbj2003.csv–notypeinformation
If your server is managed by a different OU, you can use the-searchbase option to check
Get-adcomputer-filter {operatingsystem-like "*2003*"}-properties *-searchbase "ou=cnbj,dc=contoso,dc=com" | Export-csv. \cnbj2003.csv–notypeinformation
Both of these conditions are not available and can be queried by logging in to a specific domain-controlled condition, assuming that a site has two domain controllers, DC1 and DC2, which can run the following commands on two DCs, respectively:
Get-adcomputer-filter {(operatingsystem-like "*2003*")-and (lastlogon-gt 0)}-properties *-server DC1 | Export-csv. \dc1_2003.csv-notypeinformation
It is important to note that the search condition uses the Lastlogon property that the window 2000 domain starts with, not the 2003-lastLogonTimestamp, which is a replicated (replicated) property, and all DCs are the same value. While the former is unique to different DCs, there is no login to a DC, the above attribute is null. Specifically, you can refer to Microsoft's website, I would like to make it clear that I can write a book.
The above discusses the method of using PowerShell AD module on the domain after R2, if you are still using the first version of 2003 or 2008 domain control, you can only use the csvde or dsquery * command, note that this is part of the command, dsquery Computer query function can not meet our needs, if you need detailed help, please contact!
This article is from the "Powersheller Shell" blog, please be sure to keep this source http://powersheller.blog.51cto.com/4428055/1674868
Find Windows Server 2003 servers in a domain that Microsoft stops supporting with PowerShell