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...
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...
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?
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...
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...
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)?
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 &...
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...
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
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...
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.