Use UEFI Detection for MDT 2010

6 בMay 2012



Hi Everyone

 

Lately more and more vendors are using UEFI on their models which replaces the standard BIOS.

one big difference we need to consider when we’re installing OS on a UEFI based computer is that we cannot format the HD using MBR partition style, but GPT (GUID PARTITION TABLE).

when it comes to a central OS deployment with MDT or SCCM we can run in to some issues with the Task Sequence automation.
some of you probably ran into this error during Windows 7 TS Deployment:

 

Windows cannot be installed to this disk, the selection disk has an MBR partition table. On EFI systems, Windows can only be installed to GPT disks.”


MBRPartitionTable

 

that’s because the disk has been formated automatically in MBR.

 

Good news. MDT 2012 supports UEFI  and can automatically deal with that kind of problem.

but if you want to continue have MDT 2010 and you want to be able to distinguish  UEFI models to format disk in GPT style  there’s no built-in solution by design, and there’s no WMI Query to identify UEFI.

thanks to Richard Mueller’s post, there’s a file named DetectEfi.exe that can be run from WinPE from command line which returns “UEFI” if UEFI support enabled and “LEGACY” if BIOS support enabled. (works only for x64 systems only). but how can we use it during task sequence?

 

here’s the solution:




  1. download the DetectEFI.exe and copy it to your scripts folder (DeploymentShare$\Scripts).


  2. Create a new file named DetectEFI.wsf and paste the following code and copy it to your scripts folder.
    <job id=”DetectUEFI“>
        <script language=”VBScript” src=”ZTIUtility.vbs“/>
        <script language=”VBScript“>
    // ***************************************************************************
    // 
    // Create by: Tamir Levy
    // 
    // File:      detectefi.wsf
    //
    // Usage:     Detect if the workstation has UEFI support enabled
    //            Returns Yes of true and No if False
    // 
    // ***************************************************************************
     Option Explicit

                    Dim ErrorLevel
                    Dim CurDir
                    Dim objWShell:Set objWShell = CreateObject(“Wscript.Shell“)
                    CurDir = left(WScript.ScriptFullName,(Len(WScript.ScriptFullName))-(len(WScript.ScriptName)))
                    ErrorLevel = objWShell.Run (Chr(34) & CurDir & “detectefi.exe” & Chr(34), 0, True)
                    if ErrorLevel=0 then
                                    oEnvironment.Item(“UEFI“)=”Yes
                    else
                                    oEnvironment.Item(“UEFI“)=”No
                    end if
        </script>
    </job>


    This will create an MDT variable named UEFI.


  3. Edit your MDT Task sequence. above Format and Partition Disk
    add a Run Command Line task as the following:
    Name: Detect UEFI
    Command Line: cscript.exe “%SCRIPTROOT%\DetectEFI.wsf”

    Detect EFI


  4. Edit the Format and Partition Disk task as the following:
    Name: Format and Partition Disk MBR
    Disk Type: Standard (MBR)
    Options: task sequence variable UEFI equals No


    MBR Properties
    MBR Options


  5. add another Format and Partition Disk task with the following:
    Name: Format and Partition Disk GPT
    Disk Type: Standard (MBR)
    Options: task sequence variable UEFI equals Yes
    GPT Properties
    GPT Options


  6. Save the Task Sequence and run the deployment again.

Now you are able to run the OS deploy with an auto detection and auto format task GPT \ MBR depending whether you have UEFI or not.

 

Good Luck


Tamir Levy

Agile IT Solutions

הוסף תגובה
facebook linkedin twitter email

Leave a Reply

Your email address will not be published. Required fields are marked *

תגובה אחת

  1. Pingback: Deploy UEFI and Legacy BIOS PC using a custom WinPE | Marco Moioli's Blog