Search code examples
psexecwindows-installer

Pushing flash updates printing off failed computer list


I am pushing flash to many computers using psexec and msiexec. I have figured out how to show how many passed and failed and have that printing to another text file. (DE_Flash.txt) I am trying to figure out how I can show the list of the computers that failed though. test.txt just contains a list of computer names. Is it possible to have it print out a list of the failed computers at the bottom of this?

@echo off
setlocal enabledelayedexpansion
set active_success=0
set plugin_success=0
set total=0

for /F %%G IN (test.txt) DO ( 
    set /a total+=1
    psexec \\%%G -e -h -u tc\test -p Pw#1 -n 5 msiexec /i "\\Install\Adobe\Flash\flash_player_active_x.msi" /qn >> DE_Flash.txt 2>&1
    IF !ERRORLEVEL!==0 set /a active_success+=1
    psexec \\%%G -e -h -u tc\test -p Pw#1 -n 5 msiexec /i "\\Install\Adobe\Flash\flash_player_plugin.msi" /qn >> DE_Flash.txt 2>&1
    IF !ERRORLEVEL!==0 set /a plugin_success+=1
)
echo Active Success: %active_success%/%total% >>DE_FLASH.txt
echo Plugin Success: %plugin_success%/%total% >>DE_FLASH.txt

maybe creating a new file called FailedPCs.txt and sending the pc names to the new file.

IF !ERRORLEVEL!==0 >>FailedPCs.txt.txt

somehow sending the name from the first file test.txt. This is where I am stuck trying to figure out how to send the computer name to the new txt file from the old txt file.


Solution

  • You could perhaps use this batch code:

    @echo off
    setlocal enabledelayedexpansion
    set active_success=0
    set plugin_success=0
    set total=0
    
    for /F %%G IN (test.txt) DO ( 
        set /a total+=1
        psexec \\%%G -e -h -u tc\test -p Pw#1 -n 5 msiexec /i "\\Install\Adobe\Flash\flash_player_active_x.msi" /qn >> DE_Flash.txt 2>&1
        if !ERRORLEVEL!==0 (
            set /a active_success+=1
        ) else (
            echo Player install failed on %%G>>FailedPCs.txt
        )
        psexec \\%%G -e -h -u tc\test -p Pw#1 -n 5 msiexec /i "\\Install\Adobe\Flash\flash_player_plugin.msi" /qn >> DE_Flash.txt 2>&1
        if !ERRORLEVEL!==0 (
            set /a plugin_success+=1
        ) else (
            echo Plugin install failed on %%G>>FailedPCs.txt
        )
    )
    echo Active Success: %active_success%/%total% >>DE_FLASH.txt
    echo Plugin Success: %plugin_success%/%total% >>DE_FLASH.txt
    

    But it is perhaps necessary to evaluate additionally output of the installations appended to DE_FLASH.txt to really find out for each PC if installation of player and plugin was really successful on each machine.

    The contents of text file DE_FLASH.txt containing the captured messages on installation success and also installation failure would be helpful for us.