need to create a batch to automatically install an MSI package

Home Forums Scripting General Scripting need to create a batch to automatically install an MSI package

This topic contains 6 replies, has 6 voices, and was last updated by  sajan21in 1 year, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts

  • oudmaster
    Member
    #167180

    Hi everyone,

    appreciate if someone can give me an example on my requirement, unfortunately I am very new to Windows scripting,

    I want my application server to do a task every day at 9:00am to install agents software on remote machines,

    I have used google and got the basic staff which is:

    psexec @c:test.txt -u domainusername -p password msiexec.exe /qn /i “\192.168.1.10ApplicationApp3.1.msi”

    so I can use this Batch file with task scheduler, but the thing missing is, I want the server to skip the installation if the agent is already installed on the remote machine

    something were available on the Internet like:

    IF EXIST “filename” (
    REM Do one thing
    ) ELSE (
    REM Do another thing
    )

    !

    cd %commonprogramfiles(x86)%

    but unfortunately I dont know how to link it with my command, I need help on this

    thanks,


    universal
    Member
    #388833

    Is this an Active Directory domain environment? And if so, is there any particular reason why you can’t use Software Distribution via Group Policy to push this software to the remote computers?


    sajan21in
    Member
    #390021

    actually I want to push the MSI to list of IP address instead of domain OU


    wullieb1
    Moderator
    #245673

    msiexec [/CODE]

    Is the typical way i would install a msi file. [CODE]msiexec [/CODE]

    Is the typical way i would install a msi file.


    biggles77
    Spectator
    #214307
    oudmaster;n513738 wrote:
    actually I want to push the MSI to list of IP address instead of domain OU

    Do you have Static IPs in your Domain?


    sajan21in
    Member
    #390022

    I have subnets,


    CaTBuS
    Member
    #309112

    I recognize this post is a few months old but here is a batch script solution for anybody interested. Hope this helps:

    Code:
    [USER=”68995″]Echo[/USER] OFF

    :: This script will check to see if the specified target is pingable else EXIT
    :: If the target is pingable, it will check for the existance (or lack thereof) of Notepad.exe else EXIT
    :: If Notepad does not reside on the target machine, it will execute the remote installation

    :BEGIN
    SET MSI=\ServerDirectoryNotepad.msi
    SET USERHOST=Target.domain.com

    PING -n 1 %USERHOST% >nul
    IF %ERRORLEVEL%==0 (
    GOTO INSTALL
    ) ELSE IF %ERRORLEVEL%==1 (
    GOTO END
    )

    :INSTALL
    IF NOT EXIST %USERHOST%C$WINDOWSsystem32notepad.exe (
    %~dp0psexec.exe %USERHOST% -h -u domainusername -p password msiexec.exe -i %MSI%
    GOTO END
    )

    :END
    EXIT

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.