vbs script to join domain error

Discussion in 'Windows Server' started by mjerikboo777, Feb 15, 2005.

  1. mjerikboo777

    mjerikboo777 Guest

    I am trying to join a computer in a workgroup to a test AD domain. I have
    removed the passwords on purpose but everything else is as used:
    THis code joins a computer to a domain.
    '----------Script Configuration------------
    strComputer = "IS0769.bq.com"
    strDomain = "testmig.com"
    strDomainUser = ""
    strDomainPasswd =""
    strLocalUser = "administrator"
    strLocalPasswd = ""
    '---------- end of Configuration ---------

    '#######################
    'Constants
    '#######################
    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

    '####################
    'Connect to Computer
    '####################
    set objWMILocator = CreateObject("wbemScripting.SWbemLocator")
    objWMILocator.Security_.AuthenticationLevel = 6
    set objWMIComputer = objWMILocator.ConnectServer(strComputer, _
    "root\cimv2", _
    strLocalUser, _
    strLocalPasswd)
    Set objWMIComputerSystem = objWMIComputer.Get("Win32_ComputerSystem.Name'" &
    strComputer& "'")
    '################
    ' Join Computer
    '################


    rc = objWMIComputerSystem.JoinDomainOrWorkGroup(strdomain, _
    strDomainPasswd, _
    strDomainUser, _
    vbNullString, _
    JOIN_DOMAIN)
    if rc <> 0 then
    WScript.Echo "Join Failed with Error: " & rc
    else
    WScript.Echo "Successfully joined "& strComputer & "to" & strDOmain
    end if

    This is the error I get: joindomainxp.vbs(33, 1) SWbemServicesEx: Invalid
    object path

    has anyone run into this and what do I need to change in my script/env to
    fix it??

    Thanks,
     
    mjerikboo777, Feb 15, 2005
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.