Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: using batch/PSexec to run sequence of installs  (Read 1386 times)

0 Members and 1 Guest are viewing this topic.

tstimple

    Topic Starter


    Starter

    • Experience: Beginner
    • OS: Unknown
    using batch/PSexec to run sequence of installs
    « on: May 07, 2012, 09:11:11 AM »
    Hello to all,
    I am trying to write a simple batch file to install an AV on multiple machines. I am not an experienced batch file writer, but try to adapt scripts others have written. Sometimes this takes me down the wrong path...
    What I am trying to accomplish:
    Have the batch identify 32bit versus 64bit machines then use PSexec to run the appropriate msi file to install the AV program on multiple computers listed in a txt file. Here is my approch:

    Code: [Select]
    REM Check Windows Architecture
    PsExec.exe @c:\AVinstall\AVcomputerlist.txt -s cmd /c wmic os get osarchitecture | findstr /i "32-bit" > nul | IF %ERRORLEVEL% EQU 0 (goto :os_32) ELSE (goto :os_64)


    :os_32
    PsExec.exe -s msiexec.exe -i "\\SERVER\AVinstall\AVmsi\Sep.msi" /quiet
    PsShutdown -c -t 180 -r -m "Your Antivirus software has been updated - PC will reboot in 3 minutes - Save and close any open programs"
    goto end

    :os_64
    PsExec.exe -s msiexec.exe -i "\\SERVER\AVinstall\AV64msi\Sep64.msi" /quiet
    PsShutdown -c -t 180 -r -m "Your Antivirus software has been updated - PC will reboot in 3 minutes - Save and close any open programs"
    goto end

    :end
    PAUSE

    This may be the entirely wrong approach.
    Problems...
    • The WMIC command to determine if 32 or 64 bit does not seem to work on some machines.
    • The script seems to only run the sub routine once (rather than looping back to do the next computer in the txt file list

    Any assistance would be greatly appreciated.
    THANKS!
    Tim

    Squashman



      Apprentice
    • Thanked: 44
      • Experience: Experienced
      • OS: Other
      Re: using batch/PSexec to run sequence of installs
      « Reply #1 on: May 07, 2012, 09:50:31 AM »
      Not all versions of Windows have WMIC and the OSARCHITECTURE option is only available in Vista and above.

      tstimple

        Topic Starter


        Starter

        • Experience: Beginner
        • OS: Unknown
        Re: using batch/PSexec to run sequence of installs
        « Reply #2 on: May 07, 2012, 10:24:31 AM »
        Thanks for that.
        OK. How can i determine OSarchitecture on WinXP machines?

        What other apoproach could i use for this whole process??

        Thanks,
        Tim

        Squashman



          Apprentice
        • Thanked: 44
          • Experience: Experienced
          • OS: Other
          Re: using batch/PSexec to run sequence of installs
          « Reply #3 on: May 07, 2012, 10:30:33 AM »
          Thanks for that.
          OK. How can i determine OSarchitecture on WinXP machines?

          What other apoproach could i use for this whole process??

          Thanks,
          Tim
          Well let me ask you this.  What are the odds of any of your computers running XP 64bit.  I don't know to many companies that do run that.  Heck we don't even run Windows 7 64bit where I work.

          tstimple

            Topic Starter


            Starter

            • Experience: Beginner
            • OS: Unknown
            Re: using batch/PSexec to run sequence of installs
            « Reply #4 on: May 07, 2012, 10:38:54 AM »
            Well here I have over 100 machines running 64bit. Most are windows 7 but even a few winXP-64

            Does "systeminfo" command work on XP? Could i use that to determine bit structure?

            Tim

            Salmon Trout



              Sage

              Thanked: 648
              • Yes
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 7
            Re: using batch/PSexec to run sequence of installs
            « Reply #5 on: May 07, 2012, 11:55:36 AM »
            In all 64 bit Windows if there is a folder called "%systemdrive%\Program Files (x86)" then you have WOW64 and therefore a 64 bit operating system.
            « Last Edit: May 07, 2012, 12:57:14 PM by Salmon Trout »

            Proud to be European

            Salmon Trout



              Sage

              Thanked: 648
              • Yes
            • Computer: Specs
            • Experience: Experienced
            • OS: Windows 7
            Re: using batch/PSexec to run sequence of installs
            « Reply #6 on: May 07, 2012, 01:15:35 PM »
            The command that PSEXEC executes must be included in the line; if you jump out to a label you have quit.



            Proud to be European