#85963 - 2002-06-06 01:22 PM
Deleting Exchange Mailboxes
|
Dean R
Starting to like KiXtart
Registered: 2002-03-15
Posts: 115
Loc: Ireland, but Im an Aussie
|
Is it possible to delete a mailbox from an exchange 5.5 server using ADSI? or any other method for that matter. I can find no command line tool that will allow me to do it.
_________________________
--------------------------------
When you can take this stone from my hand Gwasshoppa you are read...
*yoink*
Gwasshoppa?
Gwasshoppa? Where did you go?
---------------------------------
|
Top
|
|
|
|
#85964 - 2002-06-06 02:21 PM
Re: Deleting Exchange Mailboxes
|
Kdyer
KiX Supporter
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
|
Top
|
|
|
|
#85965 - 2002-06-06 02:21 PM
Re: Deleting Exchange Mailboxes
|
Breaker
Hey THIS is FUN
Registered: 2001-06-15
Posts: 268
Loc: Yorkshire, England
|
Dean,
You could look at this page for an example of how to do this.
And meanwhile - and I know this is well off-topic - are there any Exchange gurus, as well as avid Kixters around here? I have a problem with my Exchange org, connecting to mailboxes across domains. I won't post the details here, but if anyone thinks they might be able to help, or would just like to know the extent of my troubles so they can laugh at me, drop me an email or a private message.
Sorry about that, Dean, not trying to hijack your topic, but you gave me an opportunity to ask my question without actually asking it - cunning, eh?
I've not tried to use ADSI to talk to Exchange, but it should work fine in 5.5 and 2000. I believe Howard Bullock and Chris S have done some work in this area as well.
_________________________
================================================ Breaker
|
Top
|
|
|
|
#85966 - 2002-06-06 02:42 PM
Re: Deleting Exchange Mailboxes
|
Dean R
Starting to like KiXtart
Registered: 2002-03-15
Posts: 115
Loc: Ireland, but Im an Aussie
|
Yes, but I am having trouble writing that into Kix
This is the script, it comes back with an error when it hits "organizationalPerson" code:
$Object = GetObject ("LDAP://LIMSRVEMAIL1") $Object.delete "organizationalPerson","cn=tmctest" $Object.SetInfo Sleep 5
_________________________
--------------------------------
When you can take this stone from my hand Gwasshoppa you are read...
*yoink*
Gwasshoppa?
Gwasshoppa? Where did you go?
---------------------------------
|
Top
|
|
|
|
#85967 - 2002-06-06 03:00 PM
Re: Deleting Exchange Mailboxes
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Dean,
I don't think you've properly defined the container path yet. As a test, you can query the mailbox info for your test account. If you can read the info, then, with the appropriate rights, you should be able to delete it.
Your container path should at least include the following:
quote: '--------------------------------------------------------------- ' Build Recipient container's adsPath: ' LDAP://myserver/CN=Recipients, OU=Site, O=Org '--------------------------------------------------------------- ADsPath = "LDAP://" + yourserver ADsPath = ADsPath + "/cn=Recipients,OU=" ADsPath = ADsPath + yourSite ADsPath = ADsPath + ",O=" ADsPath = ADsPath + yourOrg
After you build your container path, then you can grab the mailbox you want to manipulate:
quote:
Set objCont = GetObject(ADsPath)
'---Create a new MailBox--- Set mailBox = objCont.Create("organizationalPerson", "cn=" & strAlias)
The above sample is a VB example to create an account, changing the "create" to "delete" should (I hope) get the job done. Unfortunately, I can't test this with you as I don't have admin rights on our Exchange server (yet).
edit: 'strAlias' is defined earlier in the script as 'username' which in their example is the UID (or Alias of the Exchange account) and the RDN (NT account associated to the mailbox). [ 06 June 2002, 15:12: Message edited by: Chris S. ]
|
Top
|
|
|
|
#85968 - 2002-06-06 03:11 PM
Re: Deleting Exchange Mailboxes
|
Dean R
Starting to like KiXtart
Registered: 2002-03-15
Posts: 115
Loc: Ireland, but Im an Aussie
|
No, still doesnt work, it gives me a script error still. It says
code:
OrganizationalPerson Script Error : Unknown Command!
_________________________
--------------------------------
When you can take this stone from my hand Gwasshoppa you are read...
*yoink*
Gwasshoppa?
Gwasshoppa? Where did you go?
---------------------------------
|
Top
|
|
|
|
#85970 - 2002-06-06 03:21 PM
Re: Deleting Exchange Mailboxes
|
Dean R
Starting to like KiXtart
Registered: 2002-03-15
Posts: 115
Loc: Ireland, but Im an Aussie
|
Yes, I can see all those. .get no problem .delete wont work yes I have admin rights to the server
_________________________
--------------------------------
When you can take this stone from my hand Gwasshoppa you are read...
*yoink*
Gwasshoppa?
Gwasshoppa? Where did you go?
---------------------------------
|
Top
|
|
|
|
#85973 - 2002-06-06 03:33 PM
Re: Deleting Exchange Mailboxes
|
Dean R
Starting to like KiXtart
Registered: 2002-03-15
Posts: 115
Loc: Ireland, but Im an Aussie
|
|
Top
|
|
|
|
#85975 - 2002-06-06 03:38 PM
Re: Deleting Exchange Mailboxes
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
Well, I'm glad Breaker could help. I quess I didn't add much to the process. JK.
I wonder if the .delete is looking for the UID or the RDN? This could make a difference in your script if they don't match.
|
Top
|
|
|
|
#85977 - 2002-06-06 06:16 PM
Re: Deleting Exchange Mailboxes
|
Chris S.
MM club member
Registered: 2002-03-18
Posts: 2368
Loc: Earth
|
I just found something that should be looked at. It seems that deleting a mailbox with this method will orphan the store resources. So...besides not only leaving the info hogging up the server's disk space, the next person to get that mailbox name will find their mailbox already populated with someone else's mail!
The M$ method uses DAPI to delete the directory object AND the store.
Reference:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q284199
|
Top
|
|
|
|
#85982 - 2002-06-12 10:28 PM
Re: Deleting Exchange Mailboxes
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Does this ADSI stuff work if you don't have the LDAP setup on your network?
I have an interesting problem:
Some users NEVER log on to our network but get email via pop3, so it is very difficult to figure out what accounts are active or not. (I don't make the policy!!!) This is compounded by the fact that McAfee GroupShield runs on our exchange server and logs in every couple of weeks when we run an "on-demand" scan of all our mailboxes, so it shows the last logon as being the McAfee and not the user... so.. does anyone have a solution for finding out which users have been active within the last 60 days, even though they do not always log in through our domain controllers?
Brian
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 557 anonymous users online.
|
|
|