What's New

Joining a Computer to a Domain Using MDT 2013 Update 1

join_domain_mdt_wpHeader One of things I haven't touch based with MDT is showing you guys how to join a domain during your deployment.  There are many ways to accomplish this within MDT like customizing the customsettings.ini file with the variables to hold the information needed to join the domain, but I'm old school and like doing this with scripting. The video will break it all down for you, plus I added the files/coding for scripts used in the video below.

VMware Network Adapter – netsh interface ip set dns "Ethernet" static xxx.xxx.xxx.xxx

Physical Machine Network Adapter – netsh interface ip set dns "Local Area Connection" static xxx.xxx.xxx.xxx

Domain Join VBScript:


Const JOIN_DOMAIN = 1
Const ACCT_CREATE = 2
Const ACCT_DELETE = 4
Const WIN9X_UPGRADE = 16
Const DOMAIN_JOIN_IF_JOINED = 32
Const JOIN_UNSECURE = 64
Const MACHINE_PASSWORD_PASSED = 128
Const DEFERRED_SPN_SET = 256
Const INSTALL_INVOCATION = 262144

strDomain = "bjtech.edu"
strPassword = "P@55w0rd2"
strUser = "Administrator"

Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName

Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _
strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & _
strComputer & "'")

ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain, _
strPassword, strDomain & "\" & strUser, NULL, _
JOIN_DOMAIN + ACCT_CREATE)
About BjTechNews (1056 Articles)
An IT guy trying to learn everything about technology and sharing it with you all. I'm a blogger and video blogger who highlights daily news in the tech industry, promoting tips and hacks for fellow techies.

2 Comments on Joining a Computer to a Domain Using MDT 2013 Update 1

  1. Tyler Durdan // October 4, 2018 at 11:35 pm // Reply

    How can I add the system to a specific OU after joining it to the domain?

  2. Does this also work for Windows 7? I followed your instructions and I just cannot get it to work in my lab.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: