Hi All,
Digging for a way to build a move mailbox procedure in a DisableUser script,
here's what I came across on MSDN. Two scripts - one uses CDO, the other one
uses ADSI. Both examples are written in VisualBasic.
I can understand most parts, but there's still some confusion about the
methods called to move the mailbox. I'm trying to convert this into
VBScript.
Both examples can be found at :
http://msdn.microsoft.com/library/en-us/e2k3/e2k3/_cdo_imailboxstore_movemailbox.asp?frame=true
How can I convert the ADSI script (written using VisualBasic) to VBScript?
Here's what I'm trying to :
1. Search User sub-routine accepts sAMAccountName as argument, searches
directory & gets recordset of all matching users - always 1 record -
sAMAccountName is unique
(This subroutine already exists in my DisableUser script)
2. For Each Record in RecordSet (already exists)
3. Set objUser = GetObject("LDAP://" & distinguishedName & "" ) 'Binds to
user (already exists)
4. Set objMailbox = objUser (from the ADSI example)
5. If objMailbox.HomeMDB = "" Then
Wscript.Echo "The user " & objUser.displayName & " does not have a
mailbox."
6. Else
Wscript.Echo "The user " & objUser.displayName & "'s mailbox resides on
the store " & objMailbox.HomeMDB
7. objMailbox.Movemailbox "LDAP://" & DCServer & "/CN=" & Moveto_MDB & _
",CN=First Storage Group,CN=InformationStore,CN=" &
_
DCServer & ",CN=Servers,CN=First
AdministrativeGroup," & _
"CN=Administrative Groups,CN=Nuance," & _
"CN=Microsoft
Exchange,CN=Services,CN=Configuration," & "DC=MyDomain,DC=com"
8. objUser.SetInfo
Wscript.Echo "Mailbox has been moved to " & Moveto_MDB & " successfully."
End If
Thanks,
Bharat Suneja
MCT