Not too long ago, we had to figure out which versions of .NET Framework Runtime were installed in our environment. It turns out it’s not difficult but not exactly straightforward either. I was expecting to find something out of the box in SCCM to cover this but I couldn’t find what I was looking for.
I then decided to turn to my old friend, PowerShell and create the script Get-NETFrameworkVersions.ps1 which is available in the GEM Automation CodePlex source code repository.
Here’s what the script does at a high level:
- Get a list of computers from the Active Directory (clients and servers, you might have to modify the filtering a bit for your environment)
- For each computer discovered from the Active Directory, start a PowerShell job that performs the following:
- Load the PSRemoteRegistry module which is required to query the registry keys containing the .NET Framework versions on the remote computers
- Check if the remote computer is online/reachable
- If the computer is online, check if the Remote Registry service is started, if not start it!
- Fetch registry keys from SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full
- Export the result in a CSV file for the computer
- Once the discovery is complete, merge all of the computers CSV files into one file
A few things to note about the discovery process:
- Versions prior to 4.x are not covered in this versions of the script
- Discovery jobs launches are throttled to not overwhelm the computer running the script, you may need to adjust the number of concurrent jobs for your computer
With the CSV file in hand you can then perform analysis on the captured data using Excel.
Should you have questions/comments about this, feel free to drop a few words below!