Partager via


Joining a Domain: Epilogue

Fault Tolerance with Join Domain or Workgroup 

Previously I mentioned that the Apply Network Settings step simply writes the domain join information to the Windows Setup answer file, and Windows Setup handles the actual domain join.  As a result, the Task Sequence is unaware of the domain join status and will continue execution after Windows Setup completes, even if the domain join fails.

If you would like to join a domain as part of Windows Setup, but need to ensure that the machine is domain joined before proceeding with subsequent steps in the task sequence, you can simply add a Join Domain or Workgroup step to your Task Sequence, right after the Setup Windows and ConfigMgr step.  If the domain join succeeded during Windows Setup, then the Join Domain or Workgroup step will simply verify this and return success.  If the domain join failed, then Join Domain or Workgroup will attempt to join the domain, and the Task Sequence will halt (and report a meaningful error code) if this fails.

If you decide to try this, you'll want to read my previous post for details about copying the network membership settings captured by the Capture Network Settings step into the Task Sequence variables used by Join Domain or Workgroup.

Your Task Sequence would end up looking something like this:

  • Capture Network Settings
  • Run Command Line: CopyDomainInfo.vbs (see below)
  • ...
  • Apply Network Settings
  • ...
  • Setup Windows and ConfigMgr
  • Join Domain or Workgroup
  • ...

CopyDomainInfo.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")