-1

I am trying to see if net 4.x or 3.5 is installed for a chm help file using client side javascript.

I am using the values from this SO post:

How do I detect what .NET Framework versions and service packs are installed?

I keep getting the following error but I checked and the key exists:

WshShell.RegRead: Unable to open registry key "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full\Install" for reading

Here is my code:

var sh= new ActiveXObject("Wscript.shell")

var t= sh.RegRead("HKLM\\Software\\Microsoft\\NET Framework Setup\\NDP\\v4\\Full\\Install");
var z= sh.RegRead("HKLM\\Software\\Microsoft\\NET Framework Setup\\NDP\\v3.5\\Install");

if(t)
   {alert('V4.x is installed');}
       else if (z) {alert('V3.5 is installed');} 
            else { alert('No framework is installed');}

Any ideas?

1 Answers1

0

Eliminate the double backslash, use single only. This will work (at least on server-side), unsure about client-side; that's typically restricted in modern browsers.

    Set objShell = CreateObject("Wscript.Shell")
    NF4 = objShell.RegRead("HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full\Install")
    NF3 = objShell.RegRead("HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\Install")
    Set objShell = Nothing