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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

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
> spreadsheet 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 spreadsheet
>
> 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 spreadsheet 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)


Relevant Pages

  • Re: Spreadsheet::WriteExcel & worksheet->write
    ... I am reading in data from a text file and need the ... script to write one line to the spreadsheet per line in the text file ... outside of the for loop. ...
    (comp.lang.perl.misc)
  • RE: export user accounts from NT 4.0 domain
    ... ATTENTION THE SCRIPT MUST BE RUNNED FROM A COMPUTER WHERE EXCEL IS ... from the information in a Microsoft Excel spreadsheet. ... Dim strLast, strFirst, strMiddle, strPW, intRow, intCol ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)
  • Re: GPO Logon Script that requires AD rights
    ... Preferring not to do this by hand, I whipped up a quick vbs script ... The script will run repeatedly, everytime someone logs on. ... From the shared log file you can create a spreadsheet with the Distinguished Names of each computer and the Distinguished Name of the OU they should be moved into. ... Then you can code a VBScript program to read the values from the final spreadsheet, bind to each OU, and use the MoveHere method to move the computer objects into the correct OU's. ...
    (microsoft.public.scripting.vbscript)
  • Re: Using group policy to set user account information
    ... I second the suggestion to use a script or ldifde. ... an Excel spreadsheet. ... Dim arrAttributes, strAttribute, strValue, intCol ... On Error GoTo 0 ...
    (microsoft.public.windows.server.active_directory)
  • Finding PC names and adding them to spreadsheet
    ... I am new to vbscripting and am trying to come up with a script that uses the ... names and populate a spreadsheet. ... Function GetMatch(strSource, strSourcePattern, intflag) ... 'affect pattern to RegExp.Pattern ...
    (microsoft.public.vb.syntax)