Jump to content
Sign in to follow this  
Steven Meier

Help with this nUDF

Recommended Posts

Steven Meier

I am having issues with is udf.

1) What is the "information Store" vlaue....now I work with exchnage 2003 and am unsure what this is referring to in ealrier versions it was private and public

2) and there is an error on this line "$objRecordSet = $ObjConnection.Execute ($strQuery) ; Retrieve the FQDN for the group, if it exists


it points to the "n.e" in the $ObjConnection.Execute


for the help

; UserCreateMailbox

; $user - User to add mailbox to

; $mdbstore - Mailbox storename

; $store - Information store

; $server - Email server

; $admingroup - Administrative group in Exchange

; $domain - Domain name

Func UserCreateMailbox($user, $mdbstore, $store, $server, $admingroup, $domain)

If ObjectExists($user) = 0 Then Return 0

Dim $objConnection, $objRootDSE

$objConnection = ObjCreate("ADODB.Connection") ; Create COM object to AD

$objConnection.Provider = "ADsDSOObject"

$objConnection.Open ("Active Directory Provider") ; Open connection to AD

$objRootDSE = ObjGet("LDAP://RootDSE")

Global $strDNSDomain = $objRootDSE.Get ("defaultNamingContext") ; Retrieve the current AD domain name

$strQuery = "<LDAP://" & $strDNSDomain & ">;(sAMAccountName=" & $user & ");ADsPath;subtree"

$objRecordSet = $ObjConnection.Execute ($strQuery) ; Retrieve the FQDN for the group, if it exists

$ldap_entry = $objRecordSet.fields (0).value

$oUser = ObjGet($ldap_entry) ; Retrieve the COM Object for the object

If $oUser.HomeMDB <> "" Then Return 0

$mailboxpath = "LDAP://CN="

$mailboxpath = $mailboxpath & $mdbstore

$mailboxpath = $mailboxpath & ",CN="

$mailboxpath = $mailboxpath & $store

$mailboxpath = $mailboxpath & ",CN=InformationStore"

$mailboxpath = $mailboxpath & ",CN="

$mailboxpath = $mailboxpath & $server

$mailboxpath = $mailboxpath & ",CN=Servers,CN="

$mailboxpath = $mailboxpath & $admingroup

$mailboxpath = $mailboxpath & ",CN=Administrative Groups,CN=State Street,CN=Microsoft Exchange,CN=Services,CN=Configuration,"

$mailboxpath = $mailboxpath & $domain

$oUser.CreateMailbox ($mailboxpath)


Return 1

EndFunc ;==>UserCreateMailbox

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.