ORIGINALLY POSTED BY TALEN FOR THETAZZONE/TAZFORUM HERE
Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to use, retain, and publish submitted work within it’s Network
Please refer to the original post as not all the script may be visible here.
This script should create a new user in AD as well as a new mailbox on an Exchange server. Use this one with caution, I haven’t really tested it yet.
- Code: Select all
Option Explicit
Dim RootDSE, myDomain
'-------------------------------------------------------------------------------
Set RootDSE = GetObject("LDAP://RootDSE")
Set myDomain = GetObject("LDAP://" & RootDSE.Get("DefaultNamingContext"))myDomainADSPath = myDomain.ADSPath ' LDAP://DC=myDomain,DC=com
myDomainPath = MID(myDomain.ADSPath,8) 'DC=myDomain,DC=comstrTitle = "New User with Exchange Mailbox"
strUserName = InputBox("What is the name of the new user?", strTitle, "John Doe")
strSAM = InputBox("What will the be the user's SAMAccount name?", strTitle, "JDoe")