MDT 2010 – Setting the Computer Description in AD without a webservice

By arwidmark / July 21, 2010

Quite a few people have asked me how to retrieve the computer description value from the MDT database or the deployment wizard, then store it in Active Directory and on the local machine, system properties. So, I decided it was time for a new blog post…

This sample does not require a web service; however, if you don’t mind using a web service, you can always use Maik Kosters excellent guide:

Setting the Computer Description in Active Directory during MDT Deployments
https://maikkoster.com/setting-the-computer-description-in-active-directory-during-mdt-deployments/

This article describes the following processes

1. Get the Computer Description value.
2. Store the Description value on the computer object in Active Directory
3. Store the Description value on the system properties of the local computer

Download the sample scripts from GitHub

Step 1 – Get the Computer Description value.

Built into MDT, you have two options: enabling the description feature in the deployment wizard or storing the value in the MDT database.

Option 1 – Enabling the computer description feature in the deployment wizard

  1. Open DeployWiz_Definition_ENU.xml in your favorite editor, and search for “Computer Description Format.”
  2. Remove the comments () around the paragraph starting with “You can also give your computer a friendly description”… see this image
  3. Configure your customsettings.ini with the following info (the Description field is on the same wizard pane as the computer name):
[Settings]
Priority=Default

[Default]
OSInstall=Y
SkipComputerName=NO

When you start the deployment wizard, the configure computer name screen will look like this:

Option 2 – Setting the value in the MDT database

If you have set the value in the MDT database, you need to query the ComputerIdentity table (because the built-in view doesn’t list the description value) or update the view. In this example, I query the ComputerIdentity table directly.

You need to add a custom property into customsettings.ini for the description property. I selected to also to set the ComputerDescription value. We are consistent with using the wizard that sets that value. Another option is to take care of that in the scripts, checking for either Description or ComputerDescription values. Still, it’s a bit easier simply to set ComputerDescription as the Description value we get from the database. Configure your customsettings.ini with the following:

[Settings]
Priority=CIdentity, Default
Properties=Description, ComputerDescription

[Default]
OSInstall=Y
ComputerDescription=%Description%

[CIdentity]
SQLServer=MDT01
Instance=SQLEXPRESS
Database=MDT
Netlib=DBNMPNTW
SQLShare=Logs$
Table=ComputerIdentity
Parameters=UUID, AssetTag, SerialNumber, MacAddress
ParameterCondition=OR

Step 2 – Store the Description value on the computer object in Active Directory

  1. Download the sample scripts.
  2. Copy ZTISetComputerDescriptionInAD.wsf to the scripts folder in your deployment share.
  3. Create a custom action in the State Restore phase; any place will do; I added the action to the Custom Tasks group. Use the following settings:
    Type:  Run Command Line
    Name:  Set Computer Description in Active Directory
    Command:  cscript.exe “%SCRIPTROOT%\ZTISetComputerDescriptionInAD.wsf”
    Runas:
    Load the user’s profile: Selected

    Note: The account you use must have permissions in Active Directory to modify computer object attributes.

Step 3 – Store the Description value on the system properties of the local computer

  1. Download the sample scripts.
  2. Copy ZTISetComputerDescriptionLocally.wsf to the scripts folder in your deployment share.
  3. Create a custom action in the State Restore phase; any place will do; I added the action to the Custom Tasks group. Use the following settings:
    Type:  Run Command Line
    Name:  Set Computer Description Locally
    Command:  cscript.exe “%SCRIPTROOT%\ZTISetComputerDescriptionLocally.wsf”

/ Johan

About the author

arwidmark