check .net version and install newer if needed

Hi,

 

I'm trying to figure out the best way to code this batch for an install package. There's a step in my install process that calls for installing .Net 4.6.1. I need the code to look on the target system and if it doesn't see .Net 4.6.1 or newer then it needs to install the .exe file.

 

I've search high and low and can't seem to find anything that will work so any help with this would be greatly appreciated.

1

Comments

3 comments
Date Votes
  • In Powershell you could do this:

    Get-ChildItem "HKLM:SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\" | Get-ItemPropertyValue -Name Release | ForEach-Object { $_ -ge 394254 }

     

    You could also do a Registry condition and use some regex on the Match. Unfortunately....I suck at Regex and haven't been able to figure this out. BUT, I know some of the PDQ lurkers here are amazing at it so they should be able to shed some light.

     

     

    You can find the information about .Net versions here: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed#ps_a

    1
  • Hi Logan,

    We did something similar with our software, we made PDQ do the legwork.

    1. Setup registry scan profile and perform the scan
    Keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\**\

    2. Create PDQ  Inventory collection based on the registry information the scanner gathered.

    3. In your PDQ deployment package, Make the condition on your .NET install step to check that if the computer 'Is Not A Member" of the 4.6.1 or latest inventory collection.


    If it is not a member of that collection, it will run the .NET install - if it is a member of the collection it will just skip to the next step in the deployment package.

    There is probably an easier way to go about doing this check, but collections make it easy to manage with further deploys

    Hope it helps

    2
  • Thanks guys! I think I've got it!

    0

Please sign in to leave a comment.

Didn't find what you were looking for?

New post