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
Here is the script:
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 2000 domain controller logged on as Admin.
The Active Directory Property cannot be found in the cache
Regards
Rob
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
Here is the script:
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 2000 domain controller logged on as Admin.
The Active Directory Property cannot be found in the cache
Regards
Rob