Find out dot net version running

Hi Experts,
Anyone knows of an easy way to determine the .net version running on my pc?
Would prefer a vba function..
Thanks
LVL 6
bfuchsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JohnBusiness Consultant (Owner)Commented:
Start with this and see what is installed.  If installed , it is "running"

http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx

All available versions from 2 forward should show up.
0
timgreen7077Exchange EngineerCommented:
The below link will show you what version of .NET you have installed currently. No downloads are needed for this check. Its found in the registry.

https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#net_b
0
bfuchsAuthor Commented:
Hi Experts,
@John,
Did not find this download at first page.
the link I followed had many downloads.
Can you post exact link for that tool?

@Timgreen,
I need this to run on each users pc, while regedit is only avail if they're logged as admin.

Thanks,
Ben
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Dave BaldwinFixer of ProblemsCommented:
This page https://blogs.msdn.microsoft.com/astebner/2008/10/13/net-framework-setup-verification-tool-users-guide/ has a link to the 'new' version that checks up to .NET Framework 4.7.1 .  Although there is a command line to 'run all tests' is listed, it seems like you have select them one at a time.
0
JohnBusiness Consultant (Owner)Commented:
On the page I posted, under download, get

http://cid-27e6a35d1a492af7.skydrive.live.com/self.aspx/Blog%7C_Tools/netfx%7C_setupverifier%7C_new.zip

I am not sure if this tool runs as non-Admin. It does not ask for UAC OK so it should work on any machine.
0
mbizupCommented:
>>> Would prefer a vba function..

One method is to list the subfolders in the .Net Framework folder, which are named according to version number.  You can modify this to return only the latest version if you want:
Sub GetDotNetVersions()
    Dim oFolder As Object
    Dim fs As Object
    Dim oSubFolder As Object
    
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set oFolder = fs.getFolder("C:\Windows\Microsoft.NET\Framework")
    
    For Each oSubFolder In oFolder.subfolders
        Debug.Print oSubFolder.Name
    Next
End Sub

Open in new window


Another (more accurate) method is to check registry keys for the various flavors of .net to determine their presence, and the specific version number.   The downside to this approach is that you have to know and update the list with the registry keys for the different versions (I don't think you can do this 'generically' for .Net versions earlier than 4.0).  This code (Sub DotNetVersion) will list the versions... .  

' This calls function GetDotNetVersionInstalled, and lists the versions.
Sub DotNetVersion()
   Dim sKey(7) As String
   Dim i As Integer
   Dim s As String
   
   ' These are the registry keys- update as needed.
   sKey(0) = "HKLM\Software\Microsoft\Active Setup\Installed Components\{78705f0d-e8db-4b2d-8193-982bdda15ecd}\Version"
   sKey(1) = "HKLM\Software\Microsoft\NET Framework Setup\NDP\v1.1.4322"
   sKey(2) = "HKLM\Software\Microsoft\NET Framework Setup\NDP\v2.0.50727\Version"
   sKey(3) = "HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.0\Version"
   sKey(4) = "HKLM\Software\Microsoft\NET Framework Setup\NDP\v3.5\Version"
   sKey(5) = "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client\Version"
   sKey(6) = "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full\Version"
   For i = 0 To 6
       s = GetDotNetVersionInstalled(sKey(i))
       If s <> "" Then Debug.Print sKey(i) & ": " & s
   Next
End Sub

' This uses Windows Scripting to read the registry for exact version for the 
Function GetDotNetVersionInstalled(sKey As String) As String
    GetDotNetVersionInstalled = ""
    Dim WS As Object
    On Error GoTo PROC_ERR
    GetDotNetVersionInstalled = ""
    
    Set WS = CreateObject("WScript.Shell")

    GetDotNetVersionInstalled = WS.RegRead(sKey)
PROC_EXIT:
    Exit Function
PROC_ERR:
    GetDotNetVersionInstalled = "Not Installed"
    Exit Function
End Function

Open in new window


Call it like this:

DotNetVersion

Open in new window

1
Shaun VermaakTechnical Specialist/DeveloperCommented:
Agree with #a42526889

I would change the first function to only look for folders that start with v
For the second I would include HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
0
bfuchsAuthor Commented:
Hi Experts,

Basically I need this for a software that requires the following
"3.      Please ensure your computer is running .NET framework 4.5 or higher."
When tried that tool suggested by John/Dave I get all successful up to 4.7.., while when I run the code from mbizup I get either v4.0.30319 or HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Client\Version: 4.7.02558
HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\Full\Version: 4.7.02558
So does that mean I'm not fully setup?

BTW, for installing .net 4.5 is this something I can just download and run?  any side affects?

Thanks,
Ben
0
JohnBusiness Consultant (Owner)Commented:
Most systems use Programs and Features, Windows Features to install .NET and I have found this best even though it means touching the machines. We set this up at initial installation
0
bfuchsAuthor Commented:
Hi John,
Are you saying that this must be setup at initial installation?
What are my options now?
Thanks,
Ben
0
JohnBusiness Consultant (Owner)Commented:
You can look at this page from Microsoft for installing .NET 4.7  

See if that works for you.

https://www.microsoft.com/en-us/download/details.aspx?id=55170
0
JohnBusiness Consultant (Owner)Commented:
Also look in Programs and Features, Windows Features.  Was .NET ever initialized on any machine?
0
bfuchsAuthor Commented:
Also look in Programs and Features, Windows Features.
I see it there 4.7 (see attached)
So is this the right way to check up?
Thanks,
Ben
Untitled.png
0
JohnBusiness Consultant (Owner)Commented:
Look in Windows Features (left side of your screen shot) Open Windows Features and see if all .NET are checked.

If they are all checked (enabled). use .NET Framework Setup Verifier to check and verify all versions.
0
bfuchsAuthor Commented:
Under windows features I only see .net 3.5 and nothing is selected. (see attached)
So I'm confused, why do I first saw 4.7 listed?
And what version do I actually have running?
This sounds like a complicate thing to figure out-:(
Why cant it be like any program or operating system that you get to see just by right clicking on my computer icon?!

Thanks,
Ben
Untitled.png
0
JohnBusiness Consultant (Owner)Commented:
What you see for .NET 3.5 is fine. That is how it shows on my systems.

But there is no .NET 4  and it looks (according to your Programs and Features) that .NET 4.7 was installed separately.

That is the way it shows up on my Windows 7 machine.

At that point, Windows Updates will look after it and keep it up to date.
0
bfuchsAuthor Commented:
What you see for .NET 3.5 is fine...At that point, Windows Updates will look after it and keep it up to date.
So you're saying that if I see .net 3.5 under windows features on windows 7 pc's (which most of our users have), and windows updates are up to date, that means we are good to go with that software mentioned above, which requires .net 4.5 or higher running?

Thanks,
Ben
0
mbizupCommented:
>>> "3.      Please ensure your computer is running .NET framework 4.5 or higher."

If all you need to do is check for .net 4.5 or higher then the VBA below will do the trick.  Per Microsoft's online documentation, the accurate way to do this is by checking the registry.  The presence of the RELEASE keyword indicates that .Net 4.5 or higher is installed.  For 4.5, the release DWord value is 378389.  Newer releases have a greater DWord value.  

This code uses 0 for releases under 4.5 (where the RELEASE keyword is not present), and flags anything >= 378389 as passing the "4.5 or higher" validation.  (If you need more details about the specific version you can add to the code according to the list of DWord values provided in that MS article)

Sub DotNetVersion()
   Dim sVersion As String
   Dim sDword As String
   Dim lng4Point5 As Long
   
   
   Dim s As String
   
   lng4Point5 = 378389
   s = "HKLM\Software\Microsoft\NET Framework Setup\NDP\v4\full\"
   
   sVersion = GetDotNetVersionInstalled(s & "version")
   sDword = GetDotNetVersionInstalled(s & "release")
   
   If Val(sDword) < lng4Point5 Then
      MsgBox "You need to have .Net 4.5 or higher installed."
   Else
      MsgBox "Validation passed.  You are running .Net version " & sVersion
   End If
End Sub

Function GetDotNetVersionInstalled(sKey As String) As String

    Dim WS As Object
    On Error GoTo PROC_ERR
    GetDotNetVersionInstalled = ""
    
    Set WS = CreateObject("WScript.Shell")

    GetDotNetVersionInstalled = WS.RegRead(sKey)
PROC_EXIT:
    Exit Function
PROC_ERR:
    GetDotNetVersionInstalled = "0"
    Exit Function
End Function

Open in new window

0
JohnBusiness Consultant (Owner)Commented:
So you're saying ... we are good to go with that software mentioned above, which requires .net 4.5 or higher running?

Yes.  Does your software run?   It should.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bfuchsAuthor Commented:
Thanks very much my experts!
0
JohnBusiness Consultant (Owner)Commented:
You are very welcome and I was happy to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.