Windows Thread, Modifying user account information in Technical; It is to do with line 8 char 1 around this area i guess, but objuser is not explicitly defined ...
-
12th September 2007, 12:38 PM #16
- Rep Power
- 16
Re: Modifying user account information
It is to do with line 8 char 1 around this area i guess, but objuser is not explicitly defined as such:
objUser.Description = strDisplayName
objUser.SetInfo
which is part of:
For each objUser in objOU
' Get the user's display name
strDisplayName = objUser.displayName
' Set the user's discription = user's display name
objUser.Description = strDisplayName
objUser.SetInfo
Next
Hope this helps,
Thanks for all the help so far! This seems like a tedious thing, but the network manager wants it!
Mark
-
-
IDG Tech News
-
12th September 2007, 12:39 PM #17
- Rep Power
- 16
Re: Modifying user account information
I also checked out the struserOU, and it matches with a ou called TESTBATCH in an existing OU called Pupil. Not sure if this makes a difference!
Ta
Mark
-
-
12th September 2007, 12:48 PM #18 Re: Modifying user account information
Line 8 Char 1 corresponds to
Code:
Set objOU = GetObject ("LDAP://" & strUserOU) Which means there is an error when trying to bind to the users OU.
If you do a WScript.Echo strUserOU, it should display:
ou=TESTBATCH,ou=Pupil,<rest of default naming context e.g. dc=xxx,dc=yyy etc.>
[Assuming the user objects to be modified are in and OU called TESTBATCH which is in an OU called Pupil which is in the domain root]
-
-
12th September 2007, 12:57 PM #19
- Rep Power
- 16
Re: Modifying user account information
It only displays ou=TESTBATCH,DC=CHASE,DC=local, even though the TESTBATCH ou is inside an existing ou called pupil, which is in the domain root!
after the echo, it still crashes, at the same point, line 8 (now line 9).
Thanks
Mark
-
-
12th September 2007, 12:59 PM #20
- Rep Power
- 16
Re: Modifying user account information
I have included my current script, modified for your perusa
Code:
Set objRootDSE = GetObject("LDAP://rootDSE")
' Define the Distinguished Name of the Organizational Unit
' containing the users to modify
strUserOU = "ou=TESTBATCH," & objRootDSE.Get("defaultNamingContext")
WScript.Echo strUserOU
' Bind to the users OU
Set objOU = GetObject ("LDAP://" & strUserOU)
' Set the filter to only return user objects
objOU.Filter = Array("user")
' Iterate through the user objects setting the required
' attributes
For each objUser in objOU
' Get the user's display name
strDisplayName = objUser.displayName
' Set the user's discription = user's display name
objUser.Description = strDisplayName
objUser.SetInfo
Next
' Clean up
Set objOU = Nothing
Set objRootDSE = Nothing Thanks
mark
-
-
12th September 2007, 01:05 PM #21 Re: Modifying user account information
Thought that may be the case, strUserOU needs to point to the correct OU of the user objects.
Probably my fault for not adding sufficient comments to the script, but objRootLDAP.Get("defaultNamingContext") only returns the distinguished name for the root of the directory, which in your case is DC=CHASE,DC=local
So, if you chnage the line
Code:
strUserOU = "ou=TESTBATCH," & objRootDSE.Get("defaultNamingContext") To read
Code:
strUserOU = "ou=TESTBATCH,ou=Pupil," & objRootDSE.Get("defaultNamingContext") Hopefully is should work.
Iain.
-
-
12th September 2007, 01:11 PM #22
- Rep Power
- 16
Re: Modifying user account information
Still crashes at Line 9!! Think I am going to give up on this!
Thanks for all the help anyway.
Mark
-
-
12th September 2007, 01:17 PM #23 Re: Modifying user account information
Did you make sure there was a comma after ou=Pupil ?
-
-
12th September 2007, 01:50 PM #24
- Rep Power
- 16
Re: Modifying user account information
Thanks that worked a treat!
Mark
-
SHARE: 
Similar Threads
-
By timbo343 in forum Windows
Replies: 8
Last Post: 18th December 2007, 01:47 PM
-
By mark_sharman in forum Network and Classroom Management
Replies: 2
Last Post: 23rd February 2007, 09:38 PM
-
By Stese in forum Windows
Replies: 3
Last Post: 4th January 2007, 09:09 PM
-
By GrumbleDook in forum Windows
Replies: 4
Last Post: 23rd January 2006, 10:54 AM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules