the deleteMailbox command worked fine with Exchange 2000 in the code below. I haven't changed the script at all but doesn't work with Exchange 2003 and generates NO error. it behaves as if deletes the mailbox just fine but the mailboxes never actually go away. Is there a new method for 2003?
I'm pretty sure it isn't a permissions problem. It is being run by the network administrator and when run under another account with insufficient privileges it will generate errors.
Code:
Set objPerson = CreateObject("CDO.Person")
objPerson.DataSource.Open adsPath
On Error Resume Next
Set iMbx = objPerson.Getinterface("IMailboxStore")
If Err.Number = 0 Then
iMbx.DeleteMailbox
If Err.Number = 0 Then
logfile.WriteLine("Mailbox Deleted")
Else
logfile.WriteLine("Unable to delete mailbox")
logfile.WriteLine(Err.Description & vbCrLf & Err.Source & vbCrLf)
Err.Clear
End If
Else
logfile.WriteLine("Mailbox not found")
logfile.WriteLine(Err.Description & vbCrLf & Err.Source & vbCrLf)
Err.Clear
End If
On Error Goto 0
Set iMbx = Nothing
Set objPerson = Nothing
I'm pretty sure it isn't a permissions problem. It is being run by the network administrator and when run under another account with insufficient privileges it will generate errors.