> Not sure what the problem might be, but sAMAccountName's are limited to 20
> characters (including the trailing "$") and should not have any of the
> following characters:
>
> " / \ [ ] : ; | , + * ? < >
>
> Other than that, the value must be unique in the domain. Also, you only
> need to invoke SetInfo once per object, after all values have been
> assigned.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab -
http://www.rlmueller.net> --
>
> "Mike" <reply[ at ]togroup.com> wrote in message
> news:OaWUxRMjHHA.4768[ at ]TK2MSFTNGP05.phx.gbl...
>> Hello, I'm running the script below to rename computers in a domain from
>> a comma separated list. I'm getting an error (8007200E) "The directory
>> server is busy" when it gets to objComputer.Put
>> "sAMAccountName",newname&"$"
>>
>> I've tried it at different times of the day when the server is not busy
>> but still getting the same error. I didn't write this script so I don't
>> fully understand what it is attempting but I'm hoping someone in here can
>> shed some light on it. All the variables (domain and credentials) are
>> correct with sufficient permissions.
>>
>> Regards,
>> Mike.
>>
>>
>>
>>
>>
>>
>>
>> Set objNetwork = CreateObject("WScript.Network")
>> strComputer = uCase(objNetwork.ComputerName)
>>
>> strBase="<LDAP://dc=domain,dc=local>;"
>> strFilter="(cn="+strComputer+");"
>> strAttrs="cn,distinguishedName;"
>> strScope="Subtree"
>> strU = "ntconnect"
>> strP = "ntconnect"
>>
>> Set objConn=CreateObject("ADODB.Connection")
>> objConn.Provider="ADsDSOObject"
>> objConn.Open "Active Directory Provider"
>> Set objRS=objConn.Execute(strBase&strFilter&strAttrs&strScope)
>> objRS.MoveFirst
>> adloc=objRS.Fields("distinguishedName")
>> poscomma=InStr(adloc,",")+1
>> adloc=Mid(adloc,poscomma,1000)
>>
>>
>> Set file_sys_obj = CreateObject("Scripting.FileSystemObject")
>> Set file_read = file_sys_obj.GetFile("\\server\netlogon\names.txt")
>> Set txtstream=file_read.openastextstream(1)
>> Do until txtstream.AtEndOfStream
>> regel=txtstream.readline
>> testname=ucase(mid(regel,1,InStr(regel,",")-1))
>> newname=UCase(Mid(regel,InStr(regel,",")+1,1000))
>> If strcomputer = testname Then
>> oldcn="cn="+strcomputer
>> newcn="cn="+newname
>> Set objCont=GetObject ("LDAP://"&adloc)
>> objCont.MoveHere "LDAP://" & oldcn & "," & adloc, newcn
>> strObject=newcn & "," & adloc
>> Set objComputer=GetObject("LDAP://"&strObject)
>> objComputer.Put "DNSHostName",newname&".domain.local"
>> objComputer.SetInfo
>> objComputer.Put "sAMAccountName",newname&"$"
>> objComputer.SetInfo
>> objComputer.Put "displayName",newname&"$"
>> objComputer.SetInfo
>>
>>
>> Set oShell=CreateObject("WScript.Shell")
>> oShell.RegWrite
>> "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerName",newname,"REG_SZ"
>> oShell.RegWrite
>> "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName",newname,"REG_SZ"
>> oShell.RegWrite
>> "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Hostname",newname,"REG_SZ"
>> oShell.RegWrite
>> "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NV
>> Hostname",newname,"REG_SZ"
>> End If
>> loop
>> txtstream.close
>
>