Install .NET 4.6.1 remotely via powershell

9,655

Solution 1

The problem was that powershell has a default remote shell memory limit of 150MB. The install of .NET 4.6.1 would load the self-extracting exe's contents into memory, some items which were > 150 MB. This link provided the correct method to increase the memory limit. http://blogs.technet.com/b/heyscriptingguy/archive/2013/07/30/learn-how-to-configure-powershell-memory.aspx

Solution 2

That executable from MS appears to just be a self extracting archive (I was able to open it with 7-Zip). Have you tried unzipping the .exe somewhere and then attempting the /q switch on the Setup.exe contained within?

Share:
9,655

Related videos on Youtube

Richthofen
Author by

Richthofen

Software developer working principally in .NET tech (but I dabble in all sorts of other stuff too). Check out the IFPA Companion app I wrote https://play.google.com/store/apps/details?id=com.edgiardina.ifpa&hl=en_US&gl=US https://apps.apple.com/lb/app/ifpa-companion/id1441736303

Updated on September 18, 2022

Comments

  • Richthofen
    Richthofen almost 2 years

    I am trying to remotely install .NET framework4.6.1 on a large group of machines. I'm using powershell to remotely script this. The problem is that for whatever reason the .exe does not seem to want to be invoked remotely. I am assuming this is due to the fact that the .exe for the upgrade launches a UI session. However, even passing the "/q" parameter which should allow the install to take place remotely, it still doesn't work. I don't get any errors, and when RDP'd into the machine in question it doesn't appear to be upgrading or using any CPU for the upgrade.

    My Script:

            Write-Host "Executing 'Upgrade dotnet 4.6' for $server"
            Invoke-Command -ComputerName $servers -Credential $credentials -ScriptBlock {
            $Url = 'https://download.microsoft.com/download/E/4/1/E4173890-A24A-4936-9FC9-AF930FE3FA40/NDP461-KB3102436-x86-x64-AllOS-ENU.exe'
            $Exe = "net461.exe"
            $Dest = "C:\\" + $Exe
            $Params = " /q"
            $client = new-object System.Net.WebClient
            $client.DownloadFile($Url,$Dest) 
            Invoke-Expression ("cmd.exe /C " + $Dest + $Params)
            } 
    

    I've also tried using chocolatey and it doesn't work either, for I think the same reasons. running chocolatey locally works.

    • Greg Askew
      Greg Askew over 8 years
      Does it work if UAC is disabled on the remote/target computer?
    • Daniel Farrell
      Daniel Farrell over 8 years
      When automating, I usually cache downloaded files somewhere within my administrative domain whenever possible. What you're doing is a time bomb that will explode when/if MS reorganizes their site or that URL rots otherwise.
  • Daniel Farrell
    Daniel Farrell over 8 years
    I think that's a good idea, believe in doing that for a similar .net runtime install.