Very nice. Thanks for that.

On Thu, Feb 18, 2010 at 10:10, tony patton
<[email protected]> wrote:
> Here's a simple one I wrote to upgrade Flash, ran by 'cscript //nologo
> UpgradeFlash.vbs <PCname>'
>
> Not pretty or perfect, but does the job for us, was written in a rush,
> have similar for FireFox and VNC
>
> I use the following batch file with the PC names in a txt file:
>
> --8<------------------------------------------------------------------
> @echo off
> @for /f %%i in (site_pcs.txt) do (
>   �...@echo Upgrading %%i...
>   �...@cscript //nologo UpgradeFlash.vbs %%i >>%%i.log 2>&1
>   �...@echo Completed %%i...
> )
> @echo Batch file finished, check log files for details
> --8<------------------------------------------------------------------
>
>
> --8<------------------------------------------------------------------
> Dim strInstallerFireFox 'The command to install the software package
> Dim strInstallerActiveX
> Dim strComputer 'The Computer
> Dim objWMIService
> Dim strProcess 'The process to terminate before running the command
> Dim objProcess
> Dim objFSO
> Dim strFilePathFireFox 'The filename and path to the installer package
> Dim strFilePathActiveX
> Dim strDestinationFireFox 'the filename and path on the destination
> computer
> Dim strDestinationActiveX
> Dim colProcess
> Dim intProcessID 'The number assigned to the process that is created
>
> 'Set the variables
> 'If there are no arguments, exit...
> If WScript.Arguments.Count <> 1 Then
>        WScript.Echo "No PC name was supplied, exitting script"
>        WScript.Echo ""
>        WScript.Echo "Usage: cscript /nologo InstallFlash10.vbs <pcname>"
>        WScript.Echo ""
>        WScript.Quit
> End If
> strComputer = UCase(Trim(WScript.Arguments(0)))
> 'Path of Flash plugin installer for FireFox on PC to be installed
> strInstallerFireFox = "c:\install_flash_player.exe /silent"
> 'Path of Flash ActiveX installer for FireFox on PC to be installed
> strInstallerActiveX = "c:\install_flash_player_ax.exe /silent"
> 'location of where the installers are to be copied from
> strFilePathFireFox =
> "\\domain\netlogon\packages\Flash10\install_flash_player.exe"
> strFilePathActiveX =
> "\\domain\netlogon\packages\Flash10\install_flash_player_ax.exe"
> 'location of where the installers are to be copied to
> strDestinationFireFox = "\\" & strComputer &
> "\c$\install_flash_player.exe"
> strDestinationActiveX = "\\" & strComputer &
> "\c$\install_flash_player_ax.exe"
>
> WScript.Echo
> "====================================================================="
>
> 'Check to see if PC is on
> If IsHostAlive(strComputer) = True Then
>        WScript.Echo "PC " & strComputer & " is turned on"
> Else
>        WScript.Echo "PC " & strComputer & " is NOT turned on, exiting..."
>        WScript.Quit
> End If
> 'Display the variables when it runs
> WScript.Echo "Target Computer: " & strComputer
> WScript.Echo "Command: " & strInstallerFireFox
> WScript.Echo "Command: " & strInstallerActiveX
> WScript.Echo "Package: " & strDestinationFireFox
> WScript.Echo "Package: " & strDestinationActiveX
>
> 'Copy the installer package to the target PC
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> Set objFileCopy = objFSO.GetFile(strFilePathFireFox)
> objFileCopy.Copy (strDestinationFireFox)
> Set objFileCopy = objFSO.GetFile(strFilePathActiveX)
> objFileCopy.Copy (strDestinationActiveX)
>
> 'Start the installer for the FireFox Plugin
> Set objWMIService =
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &
> "\root\cimv2:Win32_Process")
> errReturn = objWMIService.Create(strInstallerFireFox, Null, Null,
> intProcessID)
>
> If errReturn = 0 Then
> WScript.Echo "Flash FireFox plugin installer was started with a process ID
> of " & intProcessID
> Else
> Wscript.Echo "Installer could not be started due to error " & errReturn
> End If
>
> 'Start the installer for the ActiveX Plugin
> errReturn = objWMIService.Create(strInstallerActiveX, Null, Null,
> intProcessID)
>
> If errReturn = 0 Then
>        WScript.Echo "Flash ActiveX installer was started with a process
> ID of " & intProcessID
> Else
>        WScript.Echo "Installer could not be started due to error " &
> errReturn
> End If
> WScript.Echo "Script completed for " & strComputer
> WScript.Echo
> "====================================================================="
> WScript.Quit
>
> Function IsHostAlive(strComputer)
>        Set objPing =
> GetObject("winmgmts:{impersonationLevel=impersonate}")._
>        ExecQuery("select * from Win32_PingStatus where address = '" &
> strComputer & "'")
>        WScript.Echo "Attempting to ping PC " & strComputer
>        'WScript.Echo "  Is PC switched on? ..."
>        For Each objStatus in objPing
>                ' If there is no response, PC is not on or reachable
>        If IsNull(objStatus.StatusCode) or objStatus.StatusCode <> 0 Then
>                IsHostAlive = False
>        Else
>                IsHostAlive = True
>                End If
>        Next
> End Function
> --8<------------------------------------------------------------------
>
> Regards
>
> Tony Patton
> Desktop Operations Cavan
> Ext 8078
> Direct Dial 049 435 2878
> email: [email protected]
>
> ====================================================================
> http://www.quinn-insurance.com
>
> This e-mail is intended only for the addressee named above. The contents
> should not be copied nor disclosed to any other person. Any views or
> opinions expressed are solely those of the sender and
> do not necessarily represent those of QUINN-Insurance, unless otherwise
> specifically stated . As internet communications are not secure,
> QUINN-Insurance is not responsible for the contents of this message nor
> responsible for any change made to this message after it was sent by the
> original sender. Although virus scanning is used on all inbound and
> outbound e-mail, we advise you to carry out your own virus check before
> opening any attachment. We cannot accept liability for any damage sustained
> as a result of any software viruses.
>
> ====================================================================
>
> QUINN-Life Direct Limited is regulated by the Financial Regulator.
> QUINN-Insurance Limited is regulated by the Financial Regulator and
> regulated by the Financial Services Authority for the conduct of UK
> business.
>
> ====================================================================
>
> QUINN-Life Direct Limited is registered in Ireland, registration number
> 292374 and is a private company limited by shares.
> QUINN-Insurance Limited is registered in Ireland, registration number
> 240768 and is a private company limited by shares.
> Both companies have their head office at Dublin Road, Cavan, Co. Cavan.
>
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to