+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
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 ...
  1. #16

    Join Date
    Sep 2005
    Posts
    153
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    19

    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

  2. #17

    Join Date
    Sep 2005
    Posts
    153
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    19

    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

  3. #18
    Iain's Avatar
    Join Date
    Oct 2006
    Location
    Warwickshire
    Posts
    187
    Thank Post
    28
    Thanked 93 Times in 53 Posts
    Rep Power
    31

    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]

  4. #19

    Join Date
    Sep 2005
    Posts
    153
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    19

    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

  5. #20

    Join Date
    Sep 2005
    Posts
    153
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    19

    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

  6. #21
    Iain's Avatar
    Join Date
    Oct 2006
    Location
    Warwickshire
    Posts
    187
    Thank Post
    28
    Thanked 93 Times in 53 Posts
    Rep Power
    31

    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.

  7. #22

    Join Date
    Sep 2005
    Posts
    153
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    19

    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

  8. #23
    Iain's Avatar
    Join Date
    Oct 2006
    Location
    Warwickshire
    Posts
    187
    Thank Post
    28
    Thanked 93 Times in 53 Posts
    Rep Power
    31

    Re: Modifying user account information

    Did you make sure there was a comma after ou=Pupil ?

  9. #24

    Join Date
    Sep 2005
    Posts
    153
    Thank Post
    1
    Thanked 4 Times in 4 Posts
    Rep Power
    19

    Re: Modifying user account information

    Thanks that worked a treat!

    Mark

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Deleted Admin User Account
    By timbo343 in forum Windows
    Replies: 8
    Last Post: 18th December 2007, 01:47 PM
  2. Mandatory profile gets deleted along with the user account
    By mark_sharman in forum Network and Classroom Management
    Replies: 2
    Last Post: 23rd February 2007, 09:38 PM
  3. Replies: 3
    Last Post: 4th January 2007, 09:09 PM
  4. Modifying a mandatory profile - printers
    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
  •