Joining a Domain, Part 2

Capture Network Settings and Apply Network Settings are designed to work together to migrate network membership (and other network configuration info) from the old operating system to the new operating system.  For network membership, these actions share the following Task Sequence variables:

  • OSDJoinType (0 = domain, 1 = workgroup)
  • OSDDomainOUName
  • OSDDomainName
  • OSDWorkgroupName

These variables are set by Capture Network Settings and consumed by Apply Network Settings.

In the previous blog post, I discussed another way to join a domain during an operating system deployment, the Join Domain or Workgroup step.  This step uses a different set of variables (the join type, workgroup or domain, is passed on the command line):

  • OSDJoinDomainName
  • OSDJoinDomainOUName
  • OSDJoinWorkgroupName

Consequently, Join Domain or Workgroup will not work directly with Capture Network Settings to migrate domain membership.  However, it's easy to modify your task sequence to make these two steps work together.

The following script does two things:

  1. Copy network membership captured by Capture Network Settings to variables used by Join Domain or Workgroup
  2. Tell Apply Network Settings to join WORKGROUP.  If you don't need to migrate TCP/IP, DNS, or WINS or other adapter-specific settings, you can remove this step altogether.

The script should be inserted as a Run Command Line step, after the Capture Network Settings step and before the Join Domain or Workgroup step you inserted after the Setup Windows and ConfigMgr step. 

You'll need to make sure you provide credentials in the Join Domain or Workgroup step for an account which has domain join permissions.  In fact, you'll need to do this regardless of which method you use to join the domain.  If you choose to migrate network membership using the Apply Network Settings step, then you'll need to provide domain join credentials in that step.

NetMigrate.vbs
==============

' Create environment
SET env = CreateObject("Microsoft.SMS.TSEnvironment")

' Copy captured settings to Join Domain or Workgroup variables
env("OSDJoinDomainName") = env("OSDDomainName")
env("OSDJoinDomainOUName") = env("OSDDomainOUName")

' Tell Configure Network Settings to join WORKGROUP
env("OSDJoinType") = "1"
env("OSDWorkgroupName") = "WORKGROUP"