Deploy .msi with a .bat

Solved
reno732 Posted messages 227 Status Member -  
reno732 Posted messages 227 Status Member -
Hello,

I have several software applications to deploy on a large IT infrastructure. I would like to first create a .bat file that launches the installation of the .msi files located on the shared network location \\server\msi$ with the rights of the domain admin user admin@domain.lan and the password as the admin user's password.

I want the installation of the msis to occur automatically without any user intervention.

For now, I am starting with the command

runas /user:admin@domain.lan msiexec.exe -i \\server\msi$\application.msi

I have .msi and .mst files. In fact, for part of the IT infrastructure, the usual provider does not intervene but I have the sources for all the applications that are normally deployed in the managed OU.

Thank you in advance.

2 answers

  1. reno732 Posted messages 227 Status Member 90
     
    So for the command to start the installation, it was successful:

    start /wait msiexec /i "\\server\msi$\applications\applis.msi" /qn
    start /wait msiexec /i "\\server\msi$\applications2\applis2.msi" /qn
    ...

    I also have a rights issue to resolve:

    What option should I add to RUNAS in an Active Directory domain?

    I would like to check if the programs are already installed before running this script...
    0
    1. Redstoner26
       
      Here is a code that will allow you to launch the console (CMD) as an admin: (created by me)

      for /f "tokens=3*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName ^| Find "ProductName"') do set WINVER=%%i %%j
      echo %WINVER% | find "XP" > nul && goto commands

      if "%1" == "UAC" goto elevation
      (
      echo Set objShell = CreateObject("Shell.Application")
      echo Set objFSO = CreateObject("Scripting.FileSystemObject")
      echo strPath = objFSO.GetParentFolderName(WScript.ScriptFullName)
      echo If objFSO.FileExists("%~0") Then
      echo objShell.ShellExecute "cmd.exe", "/c ""%~0"" UAC """%~dp0"""", "", "runas", 1
      echo Else
      echo MsgBox "Script file not found"
      echo End If
      ) > "%TEMP%\UAC.vbs"
      cscript //nologo "%TEMP%\UAC.vbs"
      goto :eof
      :elevation
      del /q "%TEMP%\UAC.vbs"

      :commands
      %~d2

      cd "%~p2"
      0
    2. reno732 Posted messages 227 Status Member 90
       
      Thank you, and it's elegant if "%1" == "UAC" goto elevation, I'm testing.
      0