I needed this information too and got information with this method,
Launch PowerShell
run the 'import-module servermanager' command ( without quotes )
after that for asp.net 3.5 check run the 'get-windowsfeature web-asp-net' command ( without quotes )
for asp.net 4.5 check run the 'get-windowsfeature Net-Framework-45-Core' command ( without quotes )
Both of the commands will inform you below Install State header.
Detecting version via GUI in server environment and details can be found in this link.