1.

Solve : using batch/PSexec to run sequence of installs?

Answer»

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!
TimNot all versions of Windows have WMIC and the OSARCHITECTURE option is only available in Vista and above.Thanks for that.
OK. How can i determine OSarchitecture on WINXP machines?

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

Thanks,
Tim
Quote from: tstimple 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
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.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
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.
The command that PSEXEC executes must be included in the line; if you JUMP out to a label you have quit.




Discussion

No Comment Found