.NET Framework 4.5 remote install via PowerShell

3

I am trying to install .NET Framework 4.5 to the remote Win2008R2 Server via PowerShell session in such way (user is in the server Administrators group):

$session = New-PSSession -ComputerName $server -Credential Get-Credential
Invoke-Command -Session $session -ScriptBlock {Start-Process -FilePath "C:\temp\dotnetfx45_full_x86_x64.exe" -ArgumentList "/q /norestart" -Wait -PassThru}

And then I get this error:

Executable: C:\temp\dotnetfx45_full_x86_x64.exe v4.5.50709.17929

--- logging level: standard ---
Successfully bound to the ClusApi.dll
Error 0x80070424: Failed to open the current cluster
Cluster drive map: ''
Considering drive: 'C:\'...
Drive 'C:\' has been selected as the largest fixed drive
Directory 'C:\aa113be049433424d2d3ca\' has been selected for file extraction
Extracting files to: C:\aa113be049433424d2d3ca\
Error 0x80004005: Failed to extract all files out of box container #0.
Error 0x80004005: Failed to extract
Exiting with result code: 0x80004005
=== Logging stopped: 2013/09/04 16:29:51 ===

If I run command locally at the server - all works fine.

Start-Process -FilePath "C:\temp\dotnetfx45_full_x86_x64.exe" `
-ArgumentList "/q /norestart" -Wait

user251297

Posted 2013-09-04T14:01:49.170

Reputation: 31

Even with the latest .NET 4.7 client offline installer NDP47-KB3186497-x86-x64-AllOS-ENU.exe this still occurs trying to install remotely via a PowerShell session (winrm) on an x64 system. – Lantrix – 2017-09-11T02:58:46.417

Answers

3

I was having the exact same issue and it felt familiar so I dug through my memory and remembered how I fixed it last time. The issue is caused by the limit on the amount of memory available to your PS remote session. This article shows you how to query it. If you up it to 1GB, you should be able to install .NET 4.5 without issue.

joel newton

Posted 2013-09-04T14:01:49.170

Reputation: 31

On my remote machine (AWS EC2) I've setup this as part of the userdata: Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 2048; Restart-Service -Name WinRM and now the invoke command worked beautifully to install the .NET 4.7 DevPack which was failing on the client decompression. I've been trying to solve this for days, and it was a simple lack of memory! @user251297 this should be marked as the answer. – Lantrix – 2017-09-11T03:14:39.577

Already have MaxMemoryPerShellMB = 1024 – user251297 – 2013-12-03T15:15:27.327

0

Try disabling any firewalls and AV. 0x80004005 seems common to those.

Keltari

Posted 2013-09-04T14:01:49.170

Reputation: 57 019

Do not have any antivirus installed on the server. I have turned off Windows Firewall. Did not help. Still the same error. – user251297 – 2013-09-05T06:52:43.513

$proc = (start -FilePath "C:\temp\dotnetfx45_full_x86_x64.exe" -ArgumentList "/q /norestart" -Wait -PassThru)

$proc.ExitCode returns 16389 – user251297 – 2013-09-05T06:57:10.653