4 Replies Latest reply on Mar 6, 2018 7:35 AM by Suppnkasper

    install a .MSU file

    mbecquevort Rookie
      Hi all,

      I want to install PowerShell 5 to our win7 pc's, and found KB3134760.msu.
      I can install the .msu file with WUSA.exe, but if I create an e-Script which calls wusa.exe, the package says Successfull directly after launching, but it does not wait for wusa to terminate.

      so the script says it successfull because it can launch wusa.exe.

      is it possible to let e-script wait for a successfull install?

      I know temporarely solved it by sleeping for 5 minutes, but that's not the correct way to do so.

      Also, Can I check if PS 5 is already installed before launching the installation?


      Thank you!
        • 1. Re: install a .MSU file
          sbr2 Expert
          Hello Foreigner,

          with this script it works fine:

          !
          Set('_RV_PS','0')
          !
          If IsRunningOnX64
          ExecuteEx('wusa.exe ".\extern$\Windows6.1-KB2819745-x64-MultiPkg.msu" /quiet
          orestart /log:"%LogFileSettings.LogFilePath%\MS_PowerShellv4.evtx"','_RV_PS','20')/?/x64/TS
          Else
          ExecuteEx('wusa.exe ".\extern$\Windows6.1-KB2819745-x86-MultiPkg.msu" /quiet
          orestart /log:"%LogFileSettings.LogFilePath%\MS_PowerShellv4.evtx"','_RV_PS','20')/?/TS
          !
          If not %_RV_PS%='0'
          If %_RV_PS%='3010'
          !  All things good
          !  System_Reset/TS
          Else
            ExitProcEx(Failed,'Script execution Error - Return Value %_RV_PS%')
          !

          Best Regards,
          Stefan
          • 2. Re: install a .MSU file
            mbecquevort Rookie
            haha,

            The foreigner says thank you.


            I will test it.
            • 3. Re: install a .MSU file
              MarkusMichalski Specialist
              Hello,

              I want to install PowerShell 5 to our win7 pc's, and found KB3134760.msu. [...]
              Also, Can I check if PS 5 is already installed before launching the installation?


              this is my script to install WMF 5.1 (Powershell 5.1), including a check for the prerequisites:
              !# Package Microsoft Windows Management Framework 5.1
              !# Author: M.Michalski
              !# Created: 27.01.2017
              !# Description: will install WMF 5.1 on W2k8R2x64, W7x64, W2k12/R2x64
              !# Prereq.: Microsoft .NET Framework 4.5
              !
              If CheckPlatform(cpWinSevenx64) or CheckPlatform(cpWinSrv2008x64)
              ! # Prereq.: Microsoft .NET Framework 4.5
              If RegValueExistsEx('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full','Install',reUseX64Hive)
                RegReadValueEx('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full','Install','_Install',reUseX64Hive)
                RegReadValueEx('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full','Release','_Release',reUseX64Hive)
                If not %_Install%='1'
                 ExitProcEx(Undone,'WARNING: WMF 5.1 requires .NET Framework 4.5 to be installed first')
                If %_Release%<'378389'
                 ExitProcEx(Undone,'WARNING: WMF 5.1 requires .NET Framework 4.5 to be installed first')
              Else
                ExitProcEx(Undone,'WARNING: WMF 5.1 requires .NET Framework 4.5 to be installed first')
              ! # Install WMF 5.1 on Win7x64, or W2k8R2
              ExecuteEx('wusa.exe ".\extern$\Win7AndW2K8R2-KB3191566-x64.msu" /quiet
              orestart','_Return','10')/?/x64/TS
              If CheckPlatform(cpWinSrv2012x64)
              ! # Install WMF 5.1 on WinSrv2012x64
              ExecuteEx('wusa.exe ".\extern$\W2K12-KB3191565-x64.msu" /quiet
              orestart','_Return','10')/?/x64/TS
              If CheckPlatform(cpWinEightOnex64) or CheckPlatform(cpWinSrv2012R2x64)
              ! # Install WMF 5.1 on Win8.1x64, or W2k12R2x64
              ExecuteEx('wusa.exe ".\extern$\Win8.1AndW2K12R2-KB3191564-x64.msu" /quiet
              orestart','_Return','10')/?/x64/TS
              !
              : $BeginUninstallScript
              If CheckPlatform(cpWinSevenx64) or CheckPlatform(cpWinSrv2008x64)
              ! # Uninstall WMF 5.1 on Win7x64, or W2k8R2
              ExecuteEx('wusa.exe /kb:KB3191566 /uninstall /quiet
              orestart','_Return','10')/?/x64/TS
              If CheckPlatform(cpWinSrv2012x64)
              ! # Uninstall WMF 5.1 on WinSrv2012x64
              ExecuteEx('wusa.exe /kb:KB3191565-x64 /uninstall /quiet
              orestart','_Return','10')/?/x64/TS
              If CheckPlatform(cpWinEightOnex64) or CheckPlatform(cpWinSrv2012R2x64)
              ! # Uninstall WMF 5.1 on Win8.1x64, or W2k12R2x64
              ExecuteEx('wusa.exe /kb:KB3191564 /uninstall /quiet
              orestart','_Return','10')/?/x64/TS
              • 4. Re: install a .MSU file
                Suppnkasper Rookie

                Hello,

                 

                i tried to update the Powershell Version on a Win7 SP1 Client. .NET Framework is installed and the ExecuteEx Command runs everytime in Return Code "TimeOut".

                 

                Here is the log file:

                 

                4:37:42.973 2    ->  ExecuteEx('wusa.exe "C:\Program Files (x86)\Common Files\enteo\RepositoryCache\68363\rev\6\Extern$\Win7AndW2K8R2-KB3191566-x64.msu /quiet /norestart"','_Return','20')/?/x64/TS
                14:37:42.973 1     Disabled Wow64 file system redirection
                14:37:42.977 2     Command line logging has been enabled.
                14:37:42.978 2     To disable it, enable the flag 'Do not log command line parameters' of the command
                14:37:42.978 2     Execute: '"wusa.exe" "C:\Program Files (x86)\Common Files\enteo\RepositoryCache\68363\rev\6\Extern$\Win7AndW2K8R2-KB3191566-x64.msu /quiet /norestart"'
                14:37:43.076 2     Waiting for process...
                14:57:19.265 E     Warning (Module:Main, Severity:0x03): Process execution timed out.
                14:57:19.266 1     Setting local variable '_Return' to 'TimeOut'
                14:57:19.266 2     A timeout variable has been defined, so we do not let this script command fail, otherwise a timeout variable would not make any sense
                14:57:19.267 2     ER: Creating event manager
                14:57:19.267 1     ER: file name is C:\Program Files (x86)\NetInst\ExR\Event.erl
                14:57:19.268 1     ER: user name is dsm_run
                14:57:19.272 1     Logging up ExR event 3114 (0x00000c2a)

                 

                14:57:19.273 1     ExR is NOT allowed to send data.
                14:57:19.273 E     Warning (Module:Main, Severity:0x03): Fehler bei der Programmausführung von "wusa.exe" "C:\Program Files (x86)\Common Files\enteo\RepositoryCache\68363\rev\6\Extern$\Win7AndW2K8R2-KB3191566-x64.msu /quiet /norestart"

                Dieser Vorgang wurde wegen Zeitüberschreitung zurückgegeben. (0x000005b4)

                14:57:19.274 2     Messagebox suppressed  (No output allowed), output is written to the log files
                14:57:19.274 2     MsgBox: [Fehler bei der Programmausführung von "wusa.exe" "C:\Program Files (x86)\Common Files\enteo\RepositoryCache\68363\rev\6\Extern$\Win7AndW2K8R2-KB3191566-x64.msu /quiet /norestart"

                Dieser Vorgang wurde wegen Zeitüberschreitung zurückgegeben. (0x000005b4)

                ]

                14:57:19.274 1     Reverted state of Wow64 file system redirection
                14:57:19.275 2    New last error from script command is 1460 (0x000005b4)
                14:57:19.275 2    Resolved new last error from script command is: Dieser Vorgang wurde wegen Zeitüberschreitung zurückgegeben.