VBScript: remove exchange attributes
To disconnect the mail-enabled state from a user and effectively remove the “Exchange tabs” from the AD Users & Computers MMC snap-in, run the following script:
strUserDN = “CN=testuser,OU=tools4ever,DC=t4evmdemo,DC=local”
strDomainController = “dc01.t4evmdemo.local”
set objUser = GetObject(“LDAP://” & strDomainController & “/” & strUserDN)
objUser.MailDisable
RetVal = objUser.SetInfo()
The MailDisable function only works when a user is “mail-enabled”, not “mailbox-enabled”. To disconnect a mailbox from a user, use the Delete mailbox (AD) action within UMRA.