3 Replies Latest reply on Mar 13, 2017 10:47 AM by mbecquevort

    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
          SBRUTSCH 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