Site icon BTNHD

Offline Domain Join with MDT 2013 and Windows Operating System

Advertisements

Adding computers to the domain is difficult when the computers are not part of your network and don’t have access to the Active Directory infrastructure. We have to come up with a solution on how to join computers to the domain offline.

Okay, to do this we will need to create two PowerShell scripts. One script will provision the computer into your Active Directory and the other script is to run the djoin command on the offline client in order to perform the offline join operation.

Step One: Provision a computer


$MDTJoinComputerNameFileLocation="C:\DeploymentShare\Scripts\BTNHD"

$data=gc c:\DeploymentShare\Scripts\BTNHD\ComputerName.txt
$data | foreach {
write-host "ComputerName" $_
invoke-expression "djoin /provision /domain bjtech.edu /machine $_ /REUSE 
/savefile $MDTJoinComputerNameFileLocation\$_"
}

Step Two: Re-run the DJoin command with in Task Sequence


$working=split-path -parent $MyInvocation.MyCommand.Definition
$computer = gc env:Computername
$sysroot = gc env:systemroot
$strfile=join-path $working "BTNHD\$computer"
invoke-expression "djoin /requestODJ /loadFile $strfile /windowspath 
$sysroot /localos"
Exit mobile version