beautypg.com

2 creating images assigned to target machines – Acronis Snap Deploy 5 - User Guide User Manual

Page 144

background image

144

Copyright © Acronis International GmbH, 2002-2014

Sample script

setlocal
SET IMG_PATH=\\image_server\images
SET TMP_DRV_LETTER=h:
net use %TMP_DRV_LETTER% %IMG_PATH%
echo off
for /f "tokens=1-13 delims= " %%a in ('ipconfig /all') do (
IF %%a EQU Physical (
for /f "tokens=1-3 delims= " %%a in ('echo %%l') do (
IF EXIST %TMP_DRV_LETTER%\%%a.tib (
echo DEPLOYMENT IMAGE file: %%a.tib
asdcmd.exe /deploy /filename:%TMP_DRV_LETTER%\%%a.tib /harddisk:1 /target_partition:c
goto end
) ELSE (
echo THE IMAGE FILE %IMG_PATH%\%%a.tib NOT FOUND
)
)
)
)
:end
echo on
net use %TMP_DRV_LETTER% /d
wpeutil Reboot
endlocal

What this script does:

a) Mounts the network folder containing the set of images (one image corresponds to one target

machine)

b) Retrieves the MAC address of the target machine
c) Generates a .tib file name (if MAC address is 01-02-03-04-05-06 then the .tib file name must be

01-02-03-04-05-06.tib)

d) Searches the network folder for an image with such name
e) Deploys the image if found
f) Restarts or shuts down the target machine

Environment variables:

IMG_PATH: the path to a network folder on the deployment server.

TMP_DRV_LETTER: the mounted drive on target side.

14.2.2 Creating images assigned to target machines

Scenario

The administrator needs to create an image of each machine to be able to later roll back the system
to the imaged state by deploying the image to the same machine.

Solution

The administrator creates a script that:

Creates an image of each machine.

Names each image according to the machine’s MAC address.

The images can be deployed to the corresponding target machines (p. 143).