Share This Post

MDT 2012: Prompting When Running on Battery

Using the IsOnBattery Variable

MDT 2012 offers a new variable called IsOnBattery that determines if the system is running on battery power or is plugged in.  See Mike Niehaus’ blog for more information.
I thought it would be nice to incorporate this into the deployment wizard to remind the technician to plug in the laptop before starting the image process.
First you have to create a new XML file for the pane in the deployment wizard.  Create a file called DeployWiz_Battery.xml in the Scripts folder of the deployment share.  The content should be as follows:
<?xml version=”1.0″ encoding=”utf-8″?>
<Wizard>
<Global></Global>
<Pane id=”BatteryWarning” title=”Battery Warning”>
<Body><![CDATA[<table style=”width: 100%;”>
<tr>
<td style=”width:1px;”>
<img src=”DeployWiz_Battery.png”>
</td>
<td align=”left”>
&nbsp;The system appears to be running on battery.&nbsp; <br>Please ensure it is
plugged in to avoid a failure of the image.</td>
</tr>
</table>
</Body>
</Pane>
</Wizard>

You will also need a picture of a battery and save it  in the scripts folder of the deployment share and name it DeployWiz_Battery.png.
Now to add the pane to the wizard.  Open the DeployWiz_Definition_ENU.xml from the scripts folder on the deployment share.  Each pane in the wizard is listed here.  Decide where you want your battery pane to show up and add the following xml reference:
<Pane id=”Battery” reference=”DeployWiz_Battery.xml”>
<!–Custom Task Sequence Pane–>
<Condition>UCase(Property(“IsOnBattery”))=”TRUE”</Condition>
</Pane>
Notice the condition statement tells the wizard to only display this pane when the value of IsOnBattery is equal to True.

Save the files, unplug your laptop and launch the wizard to test it out.

Share This Post

Leave a Reply