Install .NET 4.6.1 remotely via powershell
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.
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?
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