Re: The Active Directory property cannot be found in the cache

From: Gerry Hickman (gerry666uk_at_yahoo.co.uk)
Date: 10/28/04


Date: Thu, 28 Oct 2004 20:52:57 +0100

Hi,

You don't appear to clarify which line causes the error. Please can you
turn off "On Error Resume Next" for starters.

Rob wrote:

> Hi all,
>
> Can anyone help me with this error, I am trying to create OU's from an excel
> spread*** which works ok using the script below I am also trying to create
> users in the relevant OU's which also works ok but when the accounts are
> created they are all disabled even though I think I enable them in the
> script using the line objUser.AccountDisabled = False
> Dim objExcel, objWorkbook, objOU, objUser, objDomain
> Dim intRow
>
> Set objExcel = CreateObject("Excel.Application")
> Set objWorkbook = objExcel.Workbooks.Open("D:\ou's.xls")
>
> On Error Resume Next
>
> intRow = 2
>
> 'create ou's from data in spread***
>
> Do Until objExcel.Cells(intRow,1).Value = ""
> Set objDomain = GetObject("LDAP://dc=testing,dc=com")
> Set objOU = objDomain.Create("organizationalUnit", "ou=" &
> objExcel.Cells(intRow, 1).Value)
> objOU.Setinfo
> intRow = intRow + 1
> Loop
>
> objExcel.Quit
>
> Set objWorkbook = objExcel.Workbooks.Open("D:\NewUsers.xls")
>
> intRow = 2
>
> 'create users from data in spread*** and put in relevant ou's
>
> Do Until objExcel.Cells(intRow,1).Value = ""
> Set objOU = GetObject("LDAP://ou=" & objExcel.Cells(intRow, 5).Value &
> ", dc=testing,dc=com")
> Set objUser = objOU.Create("User", "cn=" & objExcel.Cells(intRow,
> 1).Value)
> objUser.sAMAccountName = objExcel.Cells(intRow, 2).Value
> objUser.GivenName = objExcel.Cells(intRow, 3).Value
> objUser.SN = objExcel.Cells(intRow, 4).Value
> objUser.AccountDisabled = FALSE
> If Err.Number <> 0 Then
> Wscript.Echo Err.Number & "--" & Err.Description
> Err.Clear
> End If
> objUser.SetInfo
> intRow = intRow + 1
> Loop
>
> objExcel.Quit
>
> This error is reported when the script is run on a windows 200 domain
> controller.
>
>
> Regards
>
>
> Rob
>
>
>

-- 
Gerry Hickman (London UK)

Quantcast