What is the option to Delete a user mailbox?
Here's my script
Sub DisableUser(strUsername)
strLDAPConnection = "LDAP://" & strUsername
Set objUser = GetObject(strLDAPConnection)
objUser.Put "userAccountControl", 2
dtmDescriptionDate = InputBox("Inscrivez la raison de la désactivation pour" _
& objUser.DisplayName & vbCr & vbCr & "Terminaison" & vbCr & "Conge Longue Duree")
EndDate = Day(Now()) & "/" & Month(Now()) & "/" & Year(Now())
strDescription = dtmDescriptionDate & " " & objUser.Description
objUser.AccountExpirationDate = EndDate
objUser.PutEx ADS_PROPERTY_UPDATE, "description", Array(strDescription)
objUser.Put "msnpAllowDialin", "FALSE"
' objUser.RemoveMAILBOX
objUser.SetInfo
Set objOU = GetObject(PendingDeletionLDAP)
strUsername = "LDAP://" & strUsername
objOU.MoveHere strUsername, vbNullString
objUser.SetInfo
End Sub
Here's my script
Sub DisableUser(strUsername)
strLDAPConnection = "LDAP://" & strUsername
Set objUser = GetObject(strLDAPConnection)
objUser.Put "userAccountControl", 2
dtmDescriptionDate = InputBox("Inscrivez la raison de la désactivation pour" _
& objUser.DisplayName & vbCr & vbCr & "Terminaison" & vbCr & "Conge Longue Duree")
EndDate = Day(Now()) & "/" & Month(Now()) & "/" & Year(Now())
strDescription = dtmDescriptionDate & " " & objUser.Description
objUser.AccountExpirationDate = EndDate
objUser.PutEx ADS_PROPERTY_UPDATE, "description", Array(strDescription)
objUser.Put "msnpAllowDialin", "FALSE"
' objUser.RemoveMAILBOX
objUser.SetInfo
Set objOU = GetObject(PendingDeletionLDAP)
strUsername = "LDAP://" & strUsername
objOU.MoveHere strUsername, vbNullString
objUser.SetInfo
End Sub