Needs to check .NET Framework 4.8 intalled or not in local server machine

James J 586 Reputation points
2021-09-21T10:50:09.807+00:00

Hi,
Currently I have an Application which uses .NET Framework 4.8. To run we are checking .NET Framework 4.8 installed or not in the machine. if framework is available then it will install in local machine. Which we are using the below powershell script.
$frameWorkVersion = Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full' -Name Release -ErrorAction SilentlyContinue
Checks for .Net FrameWork greater than or equal to 4.8
if($frameWorkVersion.Release -ge 528040 )
{
return $True
}

The problem here is we are installing some of the application remotely which does not require to install .NET 4.8 in the remote machine.
But, the above windows registry check is not reading only in local machine.In the remote installation it is looking into remote machine windows registry instead of local machine.

I am new to powershell script, Is any way to always ensure that reading windows registry entry to check .NET 4.8 installed or not in the local machine instead of remote machine?

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 31,816 Reputation points
    2021-09-21T11:42:10.527+00:00

    I'm sorry, but I am confused by your question. What exactly do you mean by "remote installation"? Are you running SCCM or PSExec to launch an install process on some machine?

    The Get-ItemProperty cmdlet will read the registry of the machine where Powershell.exe is running. You can read the registry of some other machine by using Invoke-Command.

    https://itfordummies.net/2016/09/06/read-remote-registry-powershell

    Or you could use reg.exe and put the "\MachineName\" in front of the key name.

    https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/reg-query

    Perhaps you could clarify what process you have running on which machine.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Limitless Technology 39,371 Reputation points
    2021-09-22T08:51:29.91+00:00

    Hello @James J ,

    The offline package can be used in situations in which the web installer cannot be used because of a lack of Internet connectivity. This package is larger than the web installer and does not include the language packs.

    I recommend that you use the web installer instead of the offline installer for optimal efficiency and bandwidth requirements.

    For more information about the various command-line options that are supported by this update, see the "Command-Line Options" section in the .NET Framework Deployment Guide for Developers. using below link

    https://learn.microsoft.com/en-us/dotnet/framework/deployment/deployment-guide-for-developers

    ---------------------------------------------------------------------------------------------------------------

    Hope this answers all your queries, if not please do repost back.
    If an Answer is helpful, please click "Accept Answer" and upvote it : )

    0 comments No comments