Re: modify AD computer script to run from locally authenticated account on server
- From: worldzfree <worldzfree@xxxxxxxxx>
- Date: Thu, 10 Dec 2009 18:23:39 -0800 (PST)
The WinNTSystemInfo object returns the NT name (pre-Windows 2000 logon name)
of the user, not the Distinguished Name (DN). This makes sense, but does not
help you, you need the DN. I've heard that a server bind is sometimes
necessary, the only drawback is that you need to specify a server. The
following might help:
' Add the following.
Const ADS_SERVER_BIND = &H200
' Then use:
strServer = "MyServer"
Set objNewOU = objNS.OpenDSObject("LDAP://" & strServer & "/" & strOU,
strUser, strPassword, _
ADS_SECURE_AUTHENTICATION Or ADS_SERVER_BIND)
--
Richard Mueller
MVP Directory Services
Hilltop Lab -http://www.rlmueller.net
--
Richard,
I am still stuck. I switched back to the "ADSystemInfo" but I assume
I will need to pass credentials to run ADSystemInfo from AD? Here is
the code as it stands.
------begin paste ---------
Const ADS_SERVER_BIND = &H200
Const ADS_SECURE_AUTHENTICATION = &H1
' DC to bind to
strServer = "domaincontroller"
' Specify username to connect.
strUser = "domain\account"
' Specify password.
strPassword = "password"
' Specify DN of new OU container.
strOU = "OU=New Container,DC=sub,DC=root,DC=local"
' Retrieve DN of local computer.
Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.ComputerName
' Bind to new OU object in AD with alternate credentials.
Set objNS = GetObject("LDAP:")
Set objNewOU = objNS.OpenDSObject("LDAP://" & strServer & "/" & strOU,
strUser, strPassword, _
ADS_SECURE_AUTHENTICATION Or ADS_SERVER_BIND)
' Move the computer object in AD.
objNewOU.MoveHere "LDAP://" & strComputerDN, vbNullString
--------end paste----------
The error I get is:
Line: 18
Char: 1
Error: Logon failure: account currently disabled
Code: 80070533
Source: Null
Frustrating.
.
- Follow-Ups:
- Re: modify AD computer script to run from locally authenticated account on server
- From: Richard Mueller [MVP]
- Re: modify AD computer script to run from locally authenticated account on server
- References:
- modify AD computer script to run from locally authenticated account on server
- From: worldzfree
- Re: modify AD computer script to run from locally authenticated account on server
- From: Richard Mueller [MVP]
- Re: modify AD computer script to run from locally authenticated account on server
- From: worldzfree
- Re: modify AD computer script to run from locally authenticated account on server
- From: worldzfree
- Re: modify AD computer script to run from locally authenticated account on server
- From: Richard Mueller [MVP]
- modify AD computer script to run from locally authenticated account on server
- Prev by Date: Re: Functional Mode
- Next by Date: Re: modify AD computer script to run from locally authenticated account on server
- Previous by thread: Re: modify AD computer script to run from locally authenticated account on server
- Next by thread: Re: modify AD computer script to run from locally authenticated account on server
- Index(es):
Relevant Pages
|