As part of an application upgrade we had to check all of our Domain Controllers for the .NET Framework version installed as we had a minimum requirement. Rather than logging into each server a Powershell script can be used to remote do the check and record the output for further analysis. The script plus some more details can be found here. The script will take a list of computers to run against but with PowerShell we can pipe in the result of a Active Directory look-up serving as the input. To find out who to tailor this part please refer here. In our case all DC are following a naming convention, i.e. the DC server name will look like ‘XXX-ADC-XX’. The common pattern here is ‘ADC’ which we use as a filter for the AD query. Here is the command line:
[codesyntax lang=”powershell”]
Get-DotNet-Version.ps1 -ComputerName $(Get-ADComputer -Filter '*' | Where { $_.Name -imatch 'ADC' } | Select -ExpandProperty Name)
[/codesyntax]
After the script has finish the results will be written into three files in the current directory. The DotNet-Versions-2015-02-11.csv CSV file contain the Server name and all of the installed .NET version and can be opened with Excel for further analysis.