With the increase in use of Windows 10 operating system, you may want to find out how many Windows 10 computers are currently added to your Active Directory Domain. This code snippet will help you to query this information and export it to excel or CSV.
Get-ADComputer cmdlet in ActiveDirectory module is used for querying Computer account details and we can use it to query Windows 10 installations as well. It queries all computers that containing any version of Windows 10 Operating system.
Import-Module ActiveDirectory
Get-ADComputer -Filter { OperatingSystem -like “Windows 10*” } -Properties OperatingSystem
This code needs ActiveDirectory PowerShell module. You can also try exporting it to CSV by piping the output to Export-CSV cmdlet.
Import-Module ActiveDirectory
Get-ADComputer -Filter { OperatingSystem -like “Windows 10*” } -Properties OperatingSystem | Export-Csv c:\temp\windows10comps.csv -NoTypeInformation
You will see the output recorded in c:\temp\windows10comps.csv file.