The Tasks tab in the advanced settings of the Answer File Wizard gives you the option of creating custom tasks that will run during deployment. This is a great way to run scripts and execute other commands during different phases of deployment. Here you'll find some important notes and tips to consider when you create your tasks.
Tasks can be configured to run during one of the following phases of deployment:
- Before the image is applied (before the disk is configured)
- After the image is applied (before restarting into Sysprep)
- Specialize/Mini-Setup (during Sysprep)
- Upon first boot as system
- Upon first logon to desktop
(Optional) Copy Your Scripts to a Folder on Your Reference VM
We recommend that you copy your scrips and/or software packages to a location on your Reference VM, such as C:\Temp\, before you capture your image. This simplifies the process by eliminating the need to authenticate to network shares when accessing files referenced in your tasks or scripts.
Depending on the type of script or executable you want you run, you'll format your task command differently.
Note: The Windows file system will be mounted at T:\ during the "After the image is applied" phase.
- Batch Script (.BAT): cmd.exe /c C:\Temp\MyScript.bat
- VBS Script (.VBS): wscript.exe C:\Temp\MyScript.vbs
- PowerShell (.PS1): powershell.exe -NoProfile -NonInteractive -ExecutionPolicy bypass -file C:\Temp\MyScript.ps1
- Executable (.EXE): C:\Temp\MyApplication.exe /S
Note: Refer to the application documentation to confirm the silent installation parameters when installing from command line.
- MSI (.MSI): msiexec.exe /i C:\Temp\MyApplication.msi /quiet /norestart
Note: Refer to the application documentation to confirm the silent installation parameters when installing from a command line.
Using executables and scripts on your SmartDeploy Boot Media
When you create your Boot Media, you have the option to include additional files. Files that you select here will be saved to the z folder on the root of your boot media. If you want to use one of these files in an Answer File task, you would set the path to use the variable; %SmartDeploy_Media%. For example;
- VBS script (.VBS): wscript.exe %SmartDeploy_Media%\z\YourScript.vbs