Scripting Question

Join Domain.vbs - disable registering machine in DNS?

10/04/2017 1745 views
Quest assist with the join_domain.vbs script so machine can join the domain when deploying a system image from K2000 .  Is there somewhere in this same script to tweak or add to disable a machine from registering itself in DNS?

Such as:


                It can be scripted using Netsh


                                netsh interface ipv4 set dnsservers name="Local Network Area" source=dhcp register=none

Not sure if this is the same location in the script below as this line:

objShell.Run "netsh int ip set dns ""local area connection"" static " & _


Here is the original vbs script contents:

Const JOIN_DOMAIN             = 1

Const ACCT_CREATE             = 2

Const ACCT_DELETE             = 4

Const WIN9X_UPGRADE           = 16


Const JOIN_UNSECURE           = 64


Const DEFERRED_SPN_SET        = 256

Const INSTALL_INVOCATION      = 262144

If WScript.Arguments.Count < 3 or WScript.Arguments.Count > 4 Then

' Duff arguments so return non zero so the task is marked as failed.



strDomain   = WScript.Arguments.Item(0)

strUser = WScript.Arguments.Item(1)

strPassword = WScript.Arguments.Item(2)

'set DNS IP address

If WScript.Arguments.Count = 4 Then

    strDNSIP = WScript.Arguments.Item(3)

    Set objShell = CreateObject("WScript.shell")

    objShell.Run "netsh int ip set dns ""local area connection"" static " & _

                strDNSIP &" primary", 0 , 0

  End If

End If

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, _


1 Comment   [ + ] Show comment


  • Via Scripting it sounds like a good Poweshell Script might be needed to avoid this.

    Manual way is described here:

    and here:

Be the first to answer this question

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ