Install .net 4 remotely using powershell RRS feed

  • Question

  • I need to write a script that installs .net 4 remotely using powershell to a group of Server 2008 R2 machines.  I based my script off of

    enter-pssession -computername localhost
    $arglist = "/q /norestart /log C:\Users\tempuser\Desktop\dotnetfx4"
    $filepath = "C:\Users\tempuser\Desktop\dotNetFx40_Full_setup.exe"
    Start-Process -FilePath $filepath -ArgumentList $arglist -Wait -PassThru

    After running the command I would get the following log errors (running the same lines locally would install .net without error):

    Action: Downloading Item
    Failed to CreateJob : hr= 0x80200014
    Action: Performing actions on all Items
    Action: Performing Action on Exe at C:\Users\tempuser\Desktop\dotnetfx4\SetupUtility.exe
    Exe (C:\Users\tempuser\Desktop\dotnetfx4\SetupUtility.exe) succeeded.
     Exe Log File: dd_SetupUtility.txt
    Action complete
    Action: ServiceControl - Stop clr_optimization_v2.0.50727_32
     ServiceControl operation succeeded!
    Action complete
    Action: ServiceControl - Stop clr_optimization_v2.0.50727_64
     ServiceControl operation succeeded!
    Action complete
    Action: Performing Action on Exe at C:\Users\tempuser\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\Windows6.1-KB958488-v6001-x64.msu
    Exe (C:\Users\tempuser\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\Windows6.1-KB958488-v6001-x64.msu) failed with 0x5 - Access is denied. .
     PerformOperation on exe returned exit code 5 (translates to HRESULT = 0x5)
    Action complete
     OnFailureBehavior for this item is to Rollback.
    Action: Performing actions on all Items
    Action complete
    Action complete
    Action: Downloading using WinHttp
    WinHttpDetectAutoProxyConfigUrl failed with error: 12180
    Unable to retrieve Proxy information although WinHttpGetIEProxyConfigForCurrentUser called succeeded
    Action complete
    C:\Users\tempuser\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\TMPF279.tmp.exe: Verifying signature for netfx_Core.mzz
    C:\Users\tempuser\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\TMPF279.tmp.exe Signature verified successfully for netfx_Core.mzz
    Action complete
     Decompression completed with code: 16389
     Decompression of payload failed: C:\Users\tempuser\AppData\Local\Temp\Microsoft .NET Framework 4 Setup_4.0.30319\netfx_Core.mzz
    Action complete
     Final Result: Installation failed with error code: (0x80074005) (Elapsed time: 0 00:00:28).

    Any help determinig the cause of this issue would be wonderful.

    Monday, November 14, 2011 7:22 PM

All replies

  • Hi JakeLa,


    Welcome to the MSDN forum.


    I think you encountered such a tough problem. I would like to involve another more technical expert in this thread to help you solve this problem. From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs:;en-us;offerprophone

    Please wait for the response.


    If you have any other concerns, please feel free to let us know.


    Best Regards,

    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, November 17, 2011 3:37 AM
  • i notice there's access denial error in the log file. Did you lanuch the powershell command console as administrator?

    Tracy YU[MSFT]

    MSDN Community Support

    Saturday, November 19, 2011 1:33 PM
  • I was running as admin with a user in the administrators group.

    Monday, November 21, 2011 4:20 PM
  • since we can run the command directly on the console, please try the below approaches accoridngly

    1. remove the cmdlet enter-pssession -computername localhost

    2. speicify the administrator credential to run the command

    Start-Process -FilePath $filepath -ArgumentList $arglist -Wait -PassThru -credential administrator

    Tracy YU[MSFT] MSDN Community Support
    Tuesday, November 22, 2011 2:28 PM
  • Alright, here's what I have so far.

    1. This work perfectly.  This approach, however, doesn't allow me to remotely install .net 4 on a machine.  The snippet of code on my inital post would be expanded to call servers other than "localhost" so I could concurrently install .net 4 on a large group of server concurrently. 

      The first step of course is getting one to work!
    2. Specifying any credential through a pssession causes the following error to appear.  This doesn't happen when running on local powershell. $a was created through $a = (get-credential Administrator)
      Start-Process : This command cannot be executed due to the error: Access is denied.
      At line:1 char:14
      + Start-Process <<<<  -FilePath $exe -Wait -PassThru -Credential $a
          + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
          + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

    Currently I have a fairly hideous workaround which involves creating and running a scheduled task through pssessions for the sole purpose of running the installer executable.  Yuk.

    Tuesday, November 22, 2011 11:32 PM
  • refer the below thread, it will help you on the task
    Tracy YU[MSFT] MSDN Community Support | Feedback to us Get or Request Code Sample from Microsoft Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, December 15, 2011 11:26 AM
  • It's documented that this won't work:


    Wednesday, March 19, 2014 8:59 AM