This batch file template is a companion to the article Installing the Cloudamize Windows Agent by using a Group Policy Object and Active Directory. Use it to create the batch (.bat) file that you must place in the GPO deployment network shared folder.
- Copy and paste the template script into your code editor of choice or download the attachment at the bottom of the article. (Notepad is adequate.)
- Edit the values for the script variables (in bold, below).
- Name and save as a .BAT file.
- Place the BAT file in the network folder created with the instructions provided in the KB article linked above.
////////// BEGIN SCRIPT ///////////
@echo off
REM Begin Script
REM Remote software installation script
REM Trigger this script as a scheduled task via Group Policy
@REM INSTALL AGENT FROM LOCAL MEDIA
@echo off
setlocal EnableDelayedExpansion
REM Variables
SET FRIENDLYNAME=Cloudamize Agent
SET SOURCEFOLDER=<path where msi installer is stored. E.g., \\domain.local\agentDeploy>
SET SOURCEFILE=<name of msi installer. E.g., cloudamizeAgent.msi>
SET TARGETFOLDER=<path to place the installer on each host. E.g., C:\temp>
SET LOGFOLDER=<path to directory to store log files. E.g., \\domain.local\agentDeploy>
SET CUSTOMERKEY=<customer key obtained from application settings page. E.g., aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa>
REM Copy remote file to local folder
echo %DATE% %TIME% Began copying %FRIENDLYNAME% from %SOURCEFOLDER%\%SOURCEFILE% to %TARGETFOLDER% >>%LOGFOLDER%\%COMPUTERNAME%.txt
%SystemRoot%\system32\xcopy.exe /Y %SOURCEFOLDER%\%SOURCEFILE% %TARGETFOLDER%
echo %DATE% %TIME% Finished copying %SOURCEFOLDER%\%SOURCEFILE% from %SOURCEFOLDER% to %TARGETFOLDER% >>%LOGFOLDER%\%COMPUTERNAME%.txt
echo %COMPUTERNAME%,%DATE%,%TIME%,%FRIENDLYNAME%,copied >>%LOGFOLDER%\InstallationLog.csv
REM Install application on client
echo %DATE% %TIME% Began installing %FRIENDLYNAME% >>%LOGFOLDER%\%COMPUTERNAME%.txt
%SystemRoot%\system32\msiexec.exe /i %TARGETFOLDER%\%SOURCEFILE% customerkey=%CUSTOMERKEY% /qn
echo %DATE% %TIME% Finished installing %FRIENDLYNAME% >>%LOGFOLDER%\%COMPUTERNAME%.txt
echo %COMPUTERNAME%,%DATE%,%TIME%,%FRIENDLYNAME%,installed >>%LOGFOLDER%\InstallationLog.csv
REM Delete local installation media
REM echo %DATE% %TIME% Began deleting %TARGETFOLDER% >>%LOGFOLDER%\%COMPUTERNAME%.txt
REM rd %TARGETFOLDER% /S /Q
REM echo %DATE% %TIME% Finished deleting %TARGETFOLDER% >>%LOGFOLDER%\%COMPUTERNAME%.txt
REM echo %COMPUTERNAME%,%DATE%,%TIME%,%FRIENDLYNAME%,folder deleted >>%LOGFOLDER%\InstallationLog.csv
echo End Installation Script
////////// END SCRIPT ///////////
0 Comments