Last active
December 23, 2015 13:09
-
-
Save JamoCA/6639966 to your computer and use it in GitHub Desktop.
A simple ColdFusion script to identify which versions of .Net are installed on a Windows server. (Requires CFRegistry) ColdFusion is currently at version 10 and this information is still absent from the "System Information" page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <cfset SupportedNet = structnew()> | |
| <cfset bit32 = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\"> | |
| <cfset bit64 = "HKLM\SOFTWARE\Wow6432Node\Microsoft\NET Framework Setup\NDP\"> | |
| <cfset NetCheck = StructNew()> | |
| <cfset NetCheck["4 Client"] = {branch="#bit32#v4\Client", keys={"Install"=1, "Version"="4.0.30319"}}> | |
| <cfset NetCheck["4 Full"] = {branch="#bit32#v4\Full", keys={"Install"=1, "Version"="4.0.30319"}}> | |
| <cfset NetCheck["3.5 Original Release"] = {branch="#bit32#v3.5", keys={"Install"=1, "SP"="0"}}> | |
| <cfset NetCheck["3.5 Service Pack 1"] = {branch="#bit32#v3.5", keys={"Install"=1, "SP"="1"}}> | |
| <cfset NetCheck["3.0 Original Release"] = {branch="#bit32#v3.0", keys={"Install"=1, "SP"="0"}}> | |
| <cfset NetCheck["3.0 Service Pack 1"] = {branch="#bit32#v3.0", keys={"Install"=1, "SP"="1"}}> | |
| <cfset NetCheck["3.0 Service Pack 2"] = {branch="#bit32#v3.0", keys={"Install"=1, "SP"="2"}}> | |
| <cfset NetCheck["2.0 Original Release"] = {branch="#bit32#v2.0.50727", keys={"Install"=1, "SP"="0"}}> | |
| <cfset NetCheck["2.0 Service Pack 1"] = {branch="#bit32#v2.0.50727", keys={"Install"=1, "SP"="1"}}> | |
| <cfset NetCheck["2.0 Service Pack 2"] = {branch="#bit32#v2.0.50727", keys={"Install"=1, "SP"="2"}}> | |
| <cfset NetCheck["1.1 Original (32bit)"] = {branch="#bit32#v1.1.4322", keys={"Install"=1, "SP"="0"}}> | |
| <cfset NetCheck["1.1 Service Pack 1 (32bit)"] = {branch="#bit32#v1.1.4322", keys={"Install"=1, "SP"="1"}}> | |
| <cfset NetCheck["1.1 Original (64bit)"] = {branch="#bit64#v1.1.4322", keys={"Install"=1, "SP"="0"}}> | |
| <cfset NetCheck["1.1 Service Pack 1 (64bit)"] = {branch="#bit64#v1.1.4322", keys={"Install"=1, "SP"="1"}}> | |
| <cfloop collection="#NetCheck#" item="thisVersion"> | |
| <cfset NetVersion = NetCheck[thisVersion]> | |
| <cftry> | |
| <cfregistry action="getAll" branch="#NetVersion.Branch#" type="any" name="GetResults"> | |
| <cfset Good = 0> | |
| <cfloop query="GetResults"> | |
| <cfif structkeyexists(NetVersion.Keys, Entry) and NetVersion.Keys[Entry] is value> | |
| <cfset Good = Good + 1> | |
| </cfif> | |
| </cfloop> | |
| <cfif Good IS structcount(NetVersion.Keys)> | |
| <cfset SupportedNet[thisVersion] = trim(listrest(thisVersion," "))> | |
| </cfif> | |
| <cfcatch></cfcatch> | |
| </cftry> | |
| </cfloop> | |
| <h2>Installed .Net Versions</h2> | |
| <p>Registry keys and values published at <a href="http://support.microsoft.com/kb/318785" target="_blank">http://support.microsoft.com/kb/318785</a></p> | |
| <ul> | |
| <cfoutput> | |
| <cfset NetKeysSorted = listsort(structkeylist(SupportedNet), "textnocase")> | |
| <cfloop list="#NetKeysSorted#" index="this"> | |
| <li>#VAL(this)# (#SupportedNet[this]#)</li> | |
| </cfloop> | |
| </cfoutput> | |
| </ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment