+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
Scripts Thread, VBScript Error in Coding and Web Development; Is the error occuring when binding to the group object or when adding the user to the group? Try using ...
  1. #16
    Iain's Avatar
    Join Date
    Oct 2006
    Location
    Warwickshire
    Posts
    187
    Thank Post
    28
    Thanked 93 Times in 53 Posts
    Rep Power
    32

    Re: VBScript Error

    Is the error occuring when binding to the group object or when adding the user to the group?

    Try using WScript.Echo strUserDN and WScript.Echo strGroup to see what these variables are set to.

    Looking at your code the group should be called students and in an OU called Groups which is in the root of the directory. The user objects should should be in an OU called Year5, which is in an OU called Students, which is in the directory root. Is this correct?

    Iain.

  2. #17

    Join Date
    Mar 2007
    Location
    Cambridge, UK & Reno, USA
    Posts
    339
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: VBScript Error

    Quote Originally Posted by Iain
    Is the error occuring when binding to the group object or when adding the user to the group?

    Try using WScript.Echo strUserDN and WScript.Echo strGroup to see what these variables are set to.

    Looking at your code the group should be called students and in an OU called Groups which is in the root of the directory. The user objects should should be in an OU called Year5, which is in an OU called Students, which is in the directory root. Is this correct?

    Iain.
    I am definitely pointing to the right areas for the user and group. Having transferred my code to NoteTab Lite, I now know that it has a problem with the strUserDN line - claiming that there is no such object on the server.

    I can't seem to use the WScript.Echo because the program stops as soon as it gets to the problem, and I can only put the echo after those lines.

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

    Re: VBScript Error

    You can put a WScript.Echo anywhere you like in a script.
    If you want to know the value of strUserDN before it is used, put the echo command before the line
    Code:
    objGroup.Add(strUserDN)
    If you want to know the vale of strGroup, put the echo command before the line
    Code:
    Set objGroup = GetObject(strGroup)
    Iain.

  4. #19

    Join Date
    Mar 2007
    Location
    Cambridge, UK & Reno, USA
    Posts
    339
    Thank Post
    0
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: VBScript Error

    Quote Originally Posted by Iain
    You can put a WScript.Echo anywhere you like in a script.
    If you want to know the value of strUserDN before it is used, put the echo command before the line
    Code:
    objGroup.Add(strUserDN)
    If you want to know the vale of strGroup, put the echo command before the line
    Code:
    Set objGroup = GetObject(strGroup)
    Iain.
    It seems to return back all the correct settings: The user is in an OU called "Year5" within an OU called "Students", and the group is called "students" in an OU called "Groups". Yet still it returns this "there is no such object on the server" error.

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

    Re: VBScript Error

    The two OUs 'Students' and 'Groups' aren't inside any other OUs are they?

    It may be worth downloading an LDAP browser, such as this (needs a java > 1.2.2)

    If you use this to navigate to a user object in the Year5 OU and take a look at the distinguishedName attribute, this should be the same (excluding the ldap:// and different cn) as the output for strUserDN. Do the same for the Students group object and strGroup.

    Iain

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

    Re: VBScript Error

    Also try running the script in the Microsoft Script Debugger, this allows you to set breakpoints and check variable values on the fly.
    Use either wscript //X <scriptname> or cscript //X <scriptname> to start the debugger.

    Iain.

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

Similar Threads

  1. VBScript / SQL Server
    By Gatt in forum Scripts
    Replies: 7
    Last Post: 23rd September 2011, 03:21 PM
  2. VBScript IDE + Debugger
    By Geoff in forum Scripts
    Replies: 4
    Last Post: 13th September 2007, 08:56 PM
  3. another VBScript question!
    By StewartKnight in forum Coding
    Replies: 4
    Last Post: 3rd May 2007, 05:41 PM
  4. VBScript
    By StewartKnight in forum Coding
    Replies: 5
    Last Post: 1st May 2007, 11:04 AM
  5. vbscript arguements ?
    By mac_shinobi in forum Scripts
    Replies: 1
    Last Post: 20th February 2007, 10:29 PM

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
  •