Quick tip to help every one (including me) capturing a reference image without failing into a stupid error.
The error is well known ; ZTI ERROR – Non-zero return code by ZTIBackup, rc = 2, Failed to run the action : Create WIM.
Why it occurred was just a bad joke : there was already a WIM file with the same name in the deployment share’s captures folder.
This is the kind of error that really gets you on nerves as it only happens after several hours of installation, patching, cleaning and so on… It happened to me this morning and I decided that this was the last time !!!
Solution
To get rid of this issue, one can simply add a pinch of vbscript to the customsettings.ini file:
The used property to specify the name of the captured OS is BackupFile, MDT can be told to prefix the name with the current date with this:
BackupFile=#replace(date,"/",".") & "-Win81RefImg.wim"#
If more than one capture is done in a day, hours can also be added to the prefix with that :
BackupFile=#replace(date,"/","") & " - "& replace(time,":",".") && "-Win81RefImg.wim"#
A quick look to the BDD.log file allows to make sure that the property is correctly parsed:
Now, each time a “sysprep and capture” is launched, we can be assured that every WIM files will be created with an unique name. Captures will no more fail after hours of processing and there is no more worry about managing the content of the capture folder.
Bonus
The same technique can also be used to keep an history of your deployment logs by modifying the Slshare property like this:
SLShare=%DeployRoot%\Logs\#"%OSDComputerName% - "& replace(date,"/","") & " - "& replace(time,":",".")#
Quick reminder: To be able to perform a full automated capture you must provide additional properties like in the following example:
DOCAPTURE=YES
SkipCapture=YES
ComputerBackupLocation=%DeployRoot%\Captures
BackupFile=#replace(date,"/",".") & "-Win81RefImg.wim"#
Enjoy an easier life with a one liner !