Welcome to WiseSoft.co.uk!
Register
About
Contact
Donate
Home
Scripts
Articles
Software
Forum
Links
Active Directory Schema Guide
Submit a Script
All Scripts
Active Directory
Computer
Database
Event Logs
Exchange/Email
File System
General
Printer
SQL Server
Account Page
Address Page
COMPlus Page
DialIn Page
Environment Page
General Page
MemberOf Page
Organization Page
Profile Page
RemoteControl Page
Sessions Page
Telephones Page
TerminalServices Page
Batch File
HTA
KiXtart
PowerShell
T-SQL
VB
VBScript
Computer Accounts
Domains, Forests & Trusts
Groups
Monitoring & Replication
Organizational Units
Schema Information
Search
Sites and Subnets
User Accounts
PowerShell
VBScript
VBScript
PowerShell
VBScript
VBScript
VBScript
VBScript
VBScript
PowerShell
VBScript
VBScript
PowerShell
VBScript
HTA
KiXtart
PowerShell
VB
VBScript
VBScript
KiXtart
PowerShell
VBScript
PowerShell
VBScript
Batch File
KiXtart
PowerShell
VBScript
HTA
VB
VBScript
HTA
KiXtart
PowerShell
VBScript
HTA
PowerShell
T-SQL
VBScript
All Articles
Active Directory
Miscellaneous
Programming
Scripting
Security
SQL Server
WiseSoft
Submit Article
All Software
TSQL DDL Code History Tool
Account Management Spreadsheet
Bulk AD Users
Password Control
Script Builder
NTFSFix
TSQL DDL Code History Tool
Bulk AD Users
Password Control
Script Builder
Account Management Spreadsheet
NTFSFix
Scripting
Guestbook
Bugs
Suggestions
General
Bugs
Suggestions
General
Bugs
Suggestions
General
Bugs
Suggestions
General
Bugs
Suggestions
General
Bugs
Suggestions
General
Login
User Name:
Password:
Remember me next time
Forgot Password?
Login using OpenID:
Create free account
Exclusive access for registered users
Registered Users:
20870
Click here to find out how you can help support wisesoft.co.uk!
home
recent topics
recent posts
search
faq
AspNetForum v.5.2.7.0
WiseSoft :: Forum
:: Forum
user:
psw:
remember me
|
lost password
|
register
Home
»
Bulk AD Users
-
Bulk AD Users - Bugs
»
Strange issue with AD Update Script
|
8/25/2011 5:58:17 PM
permalink
jsirken
Posts 1
Using information picked up here, I created a script which will update our Active Directory with information from an external system. I'm testing this with an Access 2010 database linked to SQL tables.
The code below compiles, but gives an unspecified error when running. In this example, my source table has a value for "newAttribute" of 444444, and the value for strAdsPath is a long (but accurate) string containing the LDAP DN.
When debugging this, if I put a breakpoint on the line:
objUser.put "employeeID", NewAttribute
I can see that strAdsPath has a proper value, and that NewAttribute shows "444444" as a value.
When continuing past that, I get the famous "Run-time error '-2137467259(80004005)'; Automation error Unspecified error.
If it change that line of code to manually type the value instead of using NewAttribute, this works and updates AD fine. So, the above line would read:
objUser.put "employeeID", 444444
*I've tried testing this variable as a String and Long, with and without quotes - it seems that isn't the problem.
Any assistance you can offer would be greatly appreciated. Here's the function:
Public Function UpdateEmployeeID()
Dim Db As DAO.Database
Dim Rs As DAO.Recordset
Dim strAdsPath As String
Dim NewAttribute As String
Set Db = CurrentDb
Set Rs = Db.OpenRecordset("UpdateEmpId", dbOpenDynaset)
Rs.MoveLast
Rs.MoveFirst
Do While Not Rs.EOF
strAdsPath = Rs!strAdsPath.Value
NewAttribute = Rs!NewAttribute.Value
Dim objUser
'<<<< Bind to the user object using the distinguished name >>>>
Set objUser = GetObject(strAdsPath)
'<<<< Set the property >>>>
objUser.put "employeeID", 444444
objUser.setinfo 'Save Changes
Rs.MoveNext
Loop
Rs.Close
Set Rs = Nothing
Db.Close
Set Db = Nothing
End Function
, and will update Active Directory from my sample data:
9/2/2011 11:20:39 AM
permalink
admin
Posts 331
Hi,
I've tested the following and it works ok:
set objUser=GETOBJECT("LDAP://cn=test123,cn=users,dc=wisesoft,dc=co,dc=uk")
objUser.put "employeeID", 444444
objUser.SetInfo
The employeeID attribute is actually a string, but it doesn't seem to make a difference. I would check that your strADsPath value is correct.
Hope this helps,
David
pages:
1
|
Home
»
Bulk AD Users
-
Bulk AD Users - Bugs
»
Strange issue with AD Update Script