VBS Script for Creating Users in a WSS 2003 Extranet Domain
SharePoint 2007 offers a more flexible authetication model; one that does not require all users to exist in Active Directory. This will be especially useful in building WSS-based extranets. Today, with WSS 2003, extranet users must exist in an AD domain. Even if you properly configure your DMZ to have a separate AD environment for external users, it's still a pain to coordinate with IT on the creation of new client credentials (this is assuming you are not using SharePoint in AD Creation Mode). Below is a variation of a VB script I have used to automatically define new users in a DMZ AD domain. I have an OU (Orgainzational Unit) defined for my clients (I don't want to use the 'Users' collection as I might have different types of external users and I don't want folks to slip in the back door by being Domain Users). In the OU, I set different AD groups, per client. The script below is hardcoded for demonstration purposes. I have actually created a Web service to call a parameterized version of it. The Web service could then be called by a web application and could be managed by non-IT users. The goal is to create new users and assign them to the right client group... where your SharePoint sites are already wired to map security to the appropriate AD groups. This sure beats having to manage new user requests (or giving non-IT people access to the domain controller!).
'Script to create a new Client user account in the Extranet AD
'First: set the proper domain
Set oRoot = GetObject("LDAP://rootDSE")
Set oOU = GetObject("LDAP://OU=Clients, " & oRoot.Get("defaultNamingContext"))
'Second: add the user
Set oUser = oOU.Create("Users", "cn=Test Client")
oUser.Put "sAMAccountName", "testclient"
oUser.Put "sn", "Client"
oUser.Put "givenName", "Test"
oUser.Put "mail","testclient@clientcompany.com"
oUser.Put "Description", "Account created through Client creation program"
oUser.SetInfo
'Third: set the password
oUser.AccountDisabled = False
oUser.SetPassword "06Jornata!"
oUser.SetInfo
'Fourth: add user to proper Client group
set oGroup = oOU.GetObject("Group","cn=ClientA")
oGroup.Add(oUser.ADsPath)
oGroup.SetInfo