Jump to content


anyweb

How can I sync the BIOS date in WinPE to avoid PXE boot failure with System Center 2012 R2 Configuration Manager ?

Recommended Posts

Introduction

I've seen this quite a bit so I thought I might as well post it in case others see the same problem, what happens is that computers (virtual or real) that have an incorrect date in the BIOS will cause Policy retrieval problems during PXE boot.

 

Problem

Failure to retrieve policy means you cannot run any task sequence and the failure will in turn produce an error just before running any Required (Mandatory) task sequence or before displaying a list of one or more Available (optional) task sequences.

 

Note: The error produced occurs immediately after entering the PXE password if one is set. The error message displayed to the end user is shown below, in the example below the DATE was set to one year earlier than the current date:

 

Failed to Run Task Sequence An error occurred while retrieving policy for this computer (0x80004005). For more information, please contact your system administrator or helpdesk operator.

 

 

Failed to Run Task Sequence.png

 

and the actual error message shown using CMTrace in red text in the SMSTS.LOG file found in x:\windows\temp\smstslog is shown below

 

reply has no message header marker.png

 

and the text of the error message contained in SMSTS.LOG will appear something like the below

 

<![LOG[reply has no message header marker]LOG]!><time="17:18:38.515+480" date="07-22-2013" component="TSPxe" context="" type="3" thread="1260" file="libsmsmessaging.cpp:1970">
<![LOG[DoRequest (sReply, true), HRESULT=80004005 (e:\qfe\nts\sms\framework\osdmessaging\libsmsmessaging.cpp,5868)]LOG]!><time="17:18:38.515+480" date="07-22-2013" component="TSPxe" context="" type="0" thread="1260" file="libsmsmessaging.cpp:5868">
<![LOG[Failed to get client identity (80004005)]LOG]!><time="17:18:38.530+480" date="07-22-2013" component="TSPxe" context="" type="3" thread="1260" file="libsmsmessaging.cpp:6148">
<![LOG[ClientIdentity.RequestClientIdentity (), HRESULT=80004005 (e:\qfe\nts\sms\client\tasksequence\tsmbootstrap\tsmediawizardcontrol.cpp,1114)]LOG]!><time="17:18:38.530+480" date="07-22-2013" component="TSPxe" context="" type="0" thread="1260" file="tsmediawizardcontrol.cpp:1114">
<![LOG[failed to request for client]LOG]!><time="17:18:38.530+480" date="07-22-2013" component="TSPxe" context="" type="3" thread="1260" file="tsmediawizardcontrol.cpp:1114">
<![LOG[Exiting TSMediaWizardControl::GetPolicy.]LOG]!><time="17:18:38.530+480" date="07-22-2013" component="TSPxe" context="" type="0" thread="1260" file="tsmediawizardcontrol.cpp:1420">

 

 

Solution

 

Well the fix is easy enough, simply set the correct date in the bios and then reboot the client computer and PXE boot again, this time it should not get the error noted above and it should receive policy correctly.

 

While the above is an easy fix if it's a rare event you might want to automate a solution if you deal with imaging a lot of computers. So here's a method I've created to do just that, it uses the prestart ability to run a script in WinPE to sync time using NET TIME with a server you specify in your domain, it does require domain user credentials but you can decide how to deal with that.

 

So Let's get started...

 

Step 1. Download the following script

 

WinPE_timesync.zip

 

Copy this script somewhere useful on your ConfigMgr server, once done open it in notepad and configure the following section before continuing,

 

configure this section.png

 

save your changes

 

Step 2. Add a prestart command to your boot wim

 

Locate a boot image that you are using in your Task Sequences, and right click it, choose properties.

 

properties.png

 

click on the Customization tab and place a checkmark in Enable Prestart Command as in the screenshot below, enter the following in the box provided

cscript.exe WinPE_TimeSync.vbs

cscript WinPE_TimeSync.png

 

Next, place a checkmark in the Include files for the prestart command and click on browse, then browse to the network share where the script downloaded above is stored as shown in the screenshot below

 

Include files for the prestart command.png

 

Apply the changes above, and answer yes when prompted as shown below

 

update dps now.png

 

Click next when prompted and continue through that wizard to completion.

 

close.png

 

Step 3. Test PXE boot

 

Using a computer that has the bios DATE deliberately set incorrectly (like 05-05-05) PXE boot the computer. If you only have access to a virtual machine such as hyperV then PXE boot and before entering the PXE password press F8, then type Date and enter the date 05-05-05.

 

Note: Please make sure that the last deployed task sequence contain the boot image used above otherwise this prestart won't be used. You can do this by right clicking on the last deployed task sequence and verify what boot image is listed in the Advanced tab like below.

 

boot image clean.png

 

Once done, PXE boot the computer with that you plan on testing with.

 

pxeboot.png

 

If it's a virtual machine like mine, press F8 and type date to set the date to something incorrect like 05-05-05 as shown below

 

current date is 05 05 05.png

 

Note: Without the prestart command and script provided here, the above date would be enough to produce the problem mentioned at the start of this guide !

 

Now you are ready to enter the PXE password, so go ahead and enter it, then press next, if you did the above correctly the prestart will pop up a command prompt window before running the script

 

prestart popping up.png

 

After a while, you'll see the list of task sequences displayed even though the computer had an incorrect BIOS date, now that is a result, no reboot needed !

 

list of task sequence.png

So how does it all work ? well the script makes a connection to the specified server using a domain user, once this completes successfully (and it's required), we use a NET TIME command to sync the bios DATE/TIME with that on the server specified. You can see this in action by reviewing the SMSTS.log in CMTRACE

 

In the screenshot below we see the first command prompt we opened to forcefully change the date manually.

 

Notice how the logging jumps from the real date/time to 2005, that's the incorrect date now in 'action'.

 

2005.png

 

scroll down a bit until you see it executing the prestart command as shown in the screenshot below, notice how before the prestart the date is 05-05-2005 but after it's changed to the correct date and that the date change correction occurs before the Management point is contacted

 

correct date set before get command.png

 

the rest of the smsts.log file will look like any normal one processing and downloading policy before displaying the list of task sequences, this would not be possible without the fix above.

 

download policy.png

 

job done !

 

Troubleshooting

 

The script generates three log files listed below

 

  • WinPE_TimeSync.log
  • WinPE_Net_Use.log
  • WinPE_Net_Time.log

 

please refer to these logs when troubleshooting non-working scenarios, for comparison purposes you can see what my successful log files look like below:

 

WinPE_TimeSync.log

 

WinPE_TimeSync log.png

 

WinPE_Net_Use.log

 

WinPE_Net_Use log.png

 

WinPE_Net_Time.log

 

WinPE_Net_Time log.png

 

Also to note, the script outputs the net use and net time commands to the CMD prompt window (for troubleshooting), but you can REM those lines out by changing any line that begins with:

wscript.echo strCommand

to

'wscript.echo strCommand

cheers

niall

 

Related Reading

 

You can download a Microsoft Word copy of this guide here.

 

How can I sync the BIOS date in WinPE to avoid PXE boot failure with System Center 2012 R2 Configuration Manager .zip

  • Like 1

Share this post


Link to post
Share on other sites

Hi Niall,

This works a treat on my default boot image. I would like to add this to my MDT boot image I use in SCCM but already have a Prestart command. Someone suggest you can run multiple prestart commands by adding a '&' between them but when I run this command along with another yours doesn't run but the other command does. Have you ever used multiple prestart commands and what is the separator?

 

regards

 

Chiners_68

Share this post


Link to post
Share on other sites

i've tested multiple commands via a prestart such as

cmd.exe /c echo  192.168.0.1 p01.domain.lab.local >> x:\windows\system32\drivers\etc\hosts & cmd.exe /c echo  192.168.0.2 p02.domain.lab.local >> x:\windows\system32\drivers\etc\hosts

however in the guide above we are calling a script file using cscript.exe, how did you attempt to use the '&' symbol here ?

 

you could try a simple test such as below, I've verified it works just fine calling the scripts in the order provided.

cmd.exe /c cscript.exe prestart1.vbs & cscript.exe prestart2.vbs

Share this post


Link to post
Share on other sites

Didn't like the script in the root of the Prestart directory. it just ignored it and only run the ZTIMediaHook.wsf

put it in Deploy & Put the WinPE_TimeSync.vbs first, it started running that script but took a while & in the mean time the TS went to 8004005, Didn't get to prompt for Computer name from the ZTIMediaHook.wsf before the error which normally indicates date/time issue.

 

I've reversed the scripts to see if that works, ill grab the logs this time ;)

Share this post


Link to post
Share on other sites

so just run one of them and call the other script from within that one.

Dim objShell
Set objShell = Wscript.CreateObject("WScript.Shell")

objShell.Run "WinPe_TimeSync.vbs" 

' Using Set is mandatory
Set objShell = Nothing

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.