Skip to main content
Skip table of contents

(Windows) Batch File Template for Deployment with GPO and AD

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.

  1. 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.)

  2. Edit the values for the script variables (lines: 14 - 18, values within <>).

  3. Name and save as a .BAT file.

  4. Place the BAT file in the network folder created with the instructions provided in the KB article linked above.

TEXT
//////////   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   ///////////

Note: The Mass Agent Deployment Scripts are sample scripts created by Cloudamize and they may or may not work in the customer environment. The working of the scripts will depend on the customer environment configuration on which the Mass deployment is being used. Also please note that Cloudamize does not offer any support for the Mass Deployment option, since the software or the services used for Mass Deployment are not products of Cloudamize.
 

 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.