Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. DougInCanada

    regular expression conversion

    I'm a VB.NET newbie but have worked with VB5 & 6 moons ago, and I'm finally giving in to .NET from vbscripting... The following vbs code was in a script used to create users. It takes into account any hyphens, apostrophes in either the first or last names, as well as corrects for Mc and Mac...
  2. DougInCanada

    Query for pre-existing sAMAccountName

    When I try to add a duplicate name, the script kicks out this error: Error: The object already exists Code: 80071392 Source: (null) The error is generated when I try to perform the objUser.SetInfo and the sAMAccountName already exists. Is there any way to perform error handling using this...
  3. DougInCanada

    Query for pre-existing sAMAccountName

    I have a script for creating a new user object, but I need to be able to check for any pre-existing sAMAccountName in my Active Directory. Id ther a simple way to query my entire AD domain to check for any existing occurrences or do I have to query each possible specific OU? Cheers?
  4. DougInCanada

    Hyphenated Names and Apostrophes

    Phenomenal, completely changes how I can deal with strings containing patterns! No, if I can just get a handle on the pattern syntax...found this site: [link ]http://www.regular-expressions.info/reference.html[/url] Seems to be quite good for explaining patterns, as well as the other syntax...
  5. DougInCanada

    Hyphenated Names and Apostrophes

    thanks, strongm. Now I just have to try to figure out how to use regexp to capture Mc and Mac (ie: McDuff and MacDonald)....
  6. DougInCanada

    Hyphenated Names and Apostrophes

    Thanks to you both, each solution works really well. strongm, that's really interesting, it's my first encounter with regexp, seems like lots of useful opportunites, but how do I actually replace strLastName with the .replace results, rather than just display them in a message box? Cheers to...
  7. DougInCanada

    Hyphenated Names and Apostrophes

    Thanks, Geates, works great! Just to make it a little more challenging, how can I change it to detect more than one apostrophe in a hyphenated name (ie: O'Reilly-O'Shea)?
  8. DougInCanada

    Hyphenated Names and Apostrophes

    I have a script for creating user accounts which makes the first letter of a name uppercase and the rest lowercase: intLastName = Len(strLastName) strFirstLetter = UCase(Left(strLastName, 1)) strRemainingLetters = LCase(Right(strLastName, intLastName - 1)) strLastName = strFirstLetter &...
  9. DougInCanada

    changing the Account User Logon Name for an AD User Object

    Thanks, JPJ, omitting UserPrincipleName would have been a serious oversight! Much appreciated, Doug
  10. DougInCanada

    changing the Account User Logon Name for an AD User Object

    My Bad...sAMAccountName IS the donain logon name account. "Jimmy Hoffa" is the DistinguishedName...Answered my own question...
  11. DougInCanada

    changing the Account User Logon Name for an AD User Object

    After creating a user object with a Distinguished Name ie: Set objOU = GetObject("LDAP://OU=Company Users,dc=domain,dc=com") Set objUser = objOU.Create("User", "cn=Jimmy Hoffa") objUser.Put "sAMAccountName", "Jimmy Hoffa") objUser.SetInfo How do I set his Account domain Logon Name (ie...
  12. DougInCanada

    add a mailbox to a 2010 Exchange server

    I guess what I'm really after is a VBS alternative to the PS Command "Enable-Mailbox john@contoso.com -Database Sales"
  13. DougInCanada

    add a mailbox to a 2010 Exchange server

    I'm trying to create a script to create / add a mailbox to a specific mailbox DB on Exchange 2010 for a user object which I created from a script, but I have no idea where to begin. Can someone point me in the right direction? All assistance will be supremely appreciated! Cheers
  14. DougInCanada

    remove a user object from all groups they are a member of except Domain Users

    OK... So this is where I am now: I have the follwing code: [strLDAP is already valid and defined in the code several lines above this segment] Set objUser = GetObject(strLDAP) intPrimaryGroupID = objUser.Get("primaryGroupID") arrMemberOf = objUser.GetEx("memberOf") For Each Group...
  15. DougInCanada

    remove a user object from all groups they are a member of except Domain Users

    Geates, I might have stumbled onto something. Apparently, the MemberOf attribute is a backlink attribute and therefore readonly. [link]http://directory.toxz.net/topic/2/21/08-re-setinfo-causes-80072035[/url] You can't modify memberOf because it is a backlink attribute and they are calculated...
  16. DougInCanada

    remove a user object from all groups they are a member of except Domain Users

    I also see that this error can be caused by attempting to delete the user's Primary Group (which in this case is Domain Users - that's why I wanted to make an exception for that group).
  17. DougInCanada

    remove a user object from all groups they are a member of except Domain Users

    It does and it is valid as I'm using the same LDAP string for some successful code that executes just ahead of this segment.
  18. DougInCanada

    remove a user object from all groups they are a member of except Domain Users

    I've seen where this error occurs on a SetInfo with the same error code and supposedly the problem is that I'm trying to enable or 'set' a user account. The problem is that the account must have a password and none is provided. The supposed solution is to add a set password instruction to the...
  19. DougInCanada

    remove a user object from all groups they are a member of except Domain Users

    Thanks, Geates. Unfortunately, it spits an error message when trying to setinfo: "The server is unwilling to process the request" error code: 80072035. I also tried splitting the process in 2 parts, the first part removing the user object from all AD security groups and the 2nd part to...
  20. DougInCanada

    moving a user object to a different OU

    Thanks, Geates! That's a great site, it also resolves another issue I was having with removing a user object from all groups. I used this: set objOU = getobject("LDAP://ou=newOU,dc=wisesoft,dc=co,dc=uk") objOU.MoveHere "LDAP://cn=user1,cn=users,dc=wisesoft,dc=co,dc=uk",vbNullString It worked...

Part and Inventory Search

Back
Top