BDD 2007 - Reusing the SMS GUID in a New Computer deployment

When performing a refresh based deployment using Zero Touch BDD will retain the computers current SMS GUID. This is very handy if you want to rebuild a computer but not lose any information associated with the computer SMS. (i.e. Assigned applications or configuration). This also has the effect of reducing the number of duplicate records in SMS.

Unfortunately when rebuilding a computer using a New Computer scenario (from PXE or CD/DVD) the SMS GUID value will not be retained. To get around this issue I query the SMS database to see whether an SMS 2003 GUID already exists for the computer. If one does exist, the SMSCFG.ini file on the computer is updated to include the SMS 2003 GUID.

The process is used to perform this "magic" involves two main processes:

    1. Use rules to perform an SMS database lookup.

    2. During the Post Install phase the SMSCFG.ini file is updated with the correct SMS GUID.

The rest of the post details how these two processes are implemented.

Update the Rules on the ZTI Deployment Point

The next thing you need to do is update the rules on your ZTI deployment point. These rule updates perform a lookup on the SMS database. If it finds a record with its NetBios_Name0 value equal to the current computer name then it will populate the SMS_Unique_Identifier0 variable with the value from that record.

To update the rules on the deployment point, complete the following steps:

    1. Click Start, then point to All Programs. Point to BDD 2007, and then click Deployment Workbench.

    2. Open the ZTI deployment point, select the Rules tab.

    3. Add the GetSMSGUID value to the priority line of the rules:

Priority= Default, GetSMSGUID

Note - The GetSMSGUID section must be added after the section that determines the computer name.

    4. Add the SMS_Unique_Identifier0 value to the Properties line of the Rules:

Properties=SMS_Unique_Identifier0

    5. Add the following section to the end of the Rules:

[GetSMSGUID]

SQLServer=SMS DB Server

Instance= SMS DB Instance, if used

Database=SMS DB name

Netlib=Netlib type

SQLShare=Share on SMS DB Server

Table=System_DISC

Parameters=OSDNewMachinename

Order=Creation_Date0 DESC, Active0

OSDNewMachinename=Netbios_Name0

Note - For more information on how database lookups are performed using rules please refer to my rule processing blog here.

Copy the Script to the Deployment Point

The attached script will update the SMSCFG.ini file with the SMS GUID if one was identified by the rules.

    1. Copy the script Z-CONFIG-Reuse-smsguid.wsf to the .\Distribution\scripts folder.

Note - Any script in the Distribution\scripts folder that starts with a "Z" will be automatically replicated to the ZTI deployment point.

Create an Application

I am a strong believer in an application for every task you perform within BDD wether they update a file or install an application. These applications can then be added to the task sequence as required.

To create an application, complete the following steps:

    1. Click Start, then point to All Programs. Point to BDD 2007, and then click Deployment Workbench.

    2. Click Distribution Share, right-click Applications, and then click New.

    4. Select Application without source files or elsewhere on the network, and then click Next.

    5. Set Application Name to CONFIG-REUSE-SMSGUID.

Note - When creating an application you should use a naming convention that clearly identifies the purpose of the application.

    6. Set the Command Line to cscript "%SCRIPTROOT%\Z-CONFIG-REUSE-SMSGUID.wsf".

    7. Set the Working Directory to %SCRIPTROOT% .

Add the Application to the Task Sequence

Now that you have created the application you must now add it to the builds task sequence.

To add an application to the build task sequence, complete the following steps:

    1. Click Start, then point to All Programs. Point to BDD 2007, and then click Deployment Workbench.

    2. Click Builds, right-click BuildID (where BuildID is the name of the build to edit—for example, DEP-VISTA-ENTERPRISE), and then click Properties.

    3. Click the Task Sequence tab.

    4. Navigate to the Postinstall group.

    5. Select the Inject Drivers task.

    6. Click Add, and then select Application\CONFIG-REUSE-SMSGUID.

Note - This will add the CONFIG-REUSE-SMSGUID after the Inject Drivers task.

Update the BDD Deployment Point

Once the changes have been made to the rules and the applications you must update the deployment point to commit the changes and copy the new script to the deployment point.

Update the SMS Package

Now you must update the SMS package and the distribution points with the new script (Z-CONFIG-REUSE-SMSGUID.wsf) and rules.

To update the task sequence, complete the following steps:

    1. In the SMS Administrator console, locate Site Database, and then expand Image Packages.

    2. Double-click the image package you are updating, and then click the Programs subfolder.

    3. Right-click the program (for example, Install), and then click Properties.

    4. Click the Advanced tab.

    5. In the Phase selection field, ensure that Validation is selected, and then select Zero Touch Install - Validation.

    6. Click Settings.

    7. In the Custom Action dialog box, click Add.

    8. Browse to \\ServerName\ZTI$\BuildName (where BuildName is the name given to the build select all the files, and click Open.

Note - Ensure that All Files (*.*) is selected in the Files of Type dialog box.

    9. In the Custom Action dialog box, click OK.

    10. In the Install Properties dialog box, click OK.

    11. Right-click the image package, point to All Tasks, and then click Update Distribution Points.

Note - Be sure to determine the network implications of updating distribution points before performing the update.

    12. In the Confirm Update Distribution Points dialog box, click Yes.    

So that's how it done. Hopefully you will find this process useful, I certainly do. 

UPDATE - 31/12/207

This script will not work for Configuration Manager. This is because it uses certificates to identify clients rather than the GUID.

However if you are using the built-in media and PXE support provided in ConfigMgr then it will automatically look up the previous identity and try to use it.  But it will only succeed if:

       1. The site is in native mode and the new machine is given the same certificate (e.g. using AD)

       2. The site is in mixed mode and configured to manually resolve conflicting records and the admin resolves the conflict using the “Merge” action (See the “Conflicting Records” help topic 

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .

Z-CONFIG-Reuse-smsguid.zip