Page 1 of 1 1
Topic Options
#141097 - 2005-06-06 11:18 PM Search the entire exchange server.... all accounts!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
I have a question.

Just had the legal guys come into my office and are wanting to search the entire exchange database for emails that contain keywords. Anyone have and any idea on how i would go about that? I really don’t want to open up each account with the administrator, and search by hand.

Bryce

Top
#141098 - 2005-06-06 11:25 PM Re: Search the entire exchange server.... all accounts!!
masken Offline
MM club member
*****

Registered: 2000-11-27
Posts: 1222
Loc: Gothenburg, Sweden
Check this product out:
http://wm.quest.com/products/recoverymanagerexchange/

From here:
http://groups.google.se/groups?hl=sv&lr=....com%26rnum%3D6
_________________________
The tart is out there

Top
#141099 - 2005-06-06 11:25 PM Re: Search the entire exchange server.... all accounts!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
backup and av softwares do have the ability to read each mail one by one...
well, you probably need to open mailbox as the server admin but, should be able to code it...
not with kix though, I bet.
_________________________
!

download KiXnet

Top
#141100 - 2005-06-06 11:27 PM Re: Search the entire exchange server.... all accounts!!
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Don't know sh#t about com scripting but this might help.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_techsel_tech_6.asp

Quote:


ExOLEDB also provides full-text search capability over items in the Exchange store.
......
ADO can be used with any COM/Automation-compatible language, as well as with non-COM languages such as C/C++.





Edited by R2D2 (2005-06-06 11:29 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#141101 - 2005-06-06 11:49 PM Re: Search the entire exchange server.... all accounts!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wonder what non-COM means for c++...

anyways, indeed, that might be worth looking at.
_________________________
!

download KiXnet

Top
#141102 - 2005-06-07 01:42 AM Re: Search the entire exchange server.... all accounts!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
well.. got something ... some what working...

just cant figure out out to get the UDF Openmessage working, it is using the "CDO.Message" to open the email... but i get the following errors.

Quote:

-2147352567 COM exception error "Open" ((null) - The parameter is incorrect.
) [-2147352567/80020009]




I have to have somthing wrong in the OpenMessage function.

you have to run the script on the exchange server, under an account that has access to the mail box in question. the get messages function is working great, it walked the entire inbox folder with no problem.

Code:
break on
main

Function Main()
GetMessages("file://./BackOfficeStorage/<DOMAIN>/MBX/<USERID>/Inbox/")
EndFunction

function GetMessages($szURL)
dim $oConn, $oRS
$oConn = createobject("ADODB.Connection")
$oRS = createobject(ADODB.RecordSet)

Dim $szQuery

;this is a vbscript line crazy quotes?!?!?
;szQuery = "SELECT ""DAV:href"", ""urn:schemas:httpmail:subject"" FROM SCOPE('shallow traversal of """ & szURL & """')"

;kix version??
$szQuery = 'SELECT "DAV:href", "urn:schemas:httpmail:subject" FROM SCOPE(' + "'shallow traversal of " + '"'+ $szURL + '"' +"')"
? $szQuery

$oConn.ConnectionString = $szURL
$oConn.Provider = "EXOLEDB.DataSource"
$oConn.Open

$oRS.Open($szQuery, $oConn)

While not $oRS.EOF
; Do Something with this item
? $oRS.Fields("urn:schemas:httpmail:subject").Value ;Dump the message Subject
? $oRS.Fields("DAV:href").Value ;Dump the url to the message Item

; Now Open the MEssage
OpenMessage($oRS.Fields("DAV:href").Value, $oConn)

$oRS.MoveNext
Loop

$oConn = 0
$oRS = 0
Endfunction


;something is wrong with this function, errors.
function OpenMessage($szUR, $oConn)
debug on
dim $oMsg
$oMsg = createobject("CDO.Message") ? @error

; Bind to the Message Item
$oMsg.DataSource.Open($szURL, $oConn)
? @error " " @serror

; Dump some of the message properties
? $oMsg.Subject " " @error " " @serror
? $oMsg.From" " @error " " @serror
? $oMsg.To" " @error " " @serror
$oMsg = 0
Endfunction


Top
#141103 - 2005-06-07 01:51 AM Re: Search the entire exchange server.... all accounts!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there are three args, no?
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_cdo_idatasource_open.asp
_________________________
!

download KiXnet

Top
#141104 - 2005-06-07 01:58 AM Re: Search the entire exchange server.... all accounts!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh, that can't be the same object, as if it were, it would not have open method avail to kix at all
_________________________
!

download KiXnet

Top
#141105 - 2005-06-07 02:09 AM Re: Search the entire exchange server.... all accounts!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, this looks good:
http://www.cdolive.com/deletespammessage.htm

note, non kix code required!
_________________________
!

download KiXnet

Top
#141106 - 2005-06-07 05:58 AM Re: Search the entire exchange server.... all accounts!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
i found a way to get at it with out using "cdo.message" Will post what i foud tomorrow morning when i get back in the office.

Bryce

Top
#141107 - 2005-06-07 05:20 PM Re: Search the entire exchange server.... all accounts!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
This is what i have so far. I can access the text of an email, and search for keywords (simple instr() should do it) in all emails of a given users email folder. You need to run this ecript on the exchange server, and the account that you run it under needs full access to the exchange store.

Now that I can find the emails, i need to figure out what to do with them, i recall seeing some move/copy commands yesterday. perhaps copy the keyword emails to another user folder. something that i could then archive off to a cd and hand to the lawyers to make them happy

Bryce

Code:

GetMessages("http://<server>/exchange/<user>/inbox")


Function GetMessages($szURL, optional $oconn)

DIM $ors, $szQuery, $count, $url

If VarType($oConn) <> 9
$oConn = CreateObject("ADODB.Connection")
EndIf

$oRS = CreateObject(ADODB.RecordSet)

$szQuery = 'SELECT "DAV:href", '+
'"urn:schemas:httpmail:subject",'+
'"urn:schemas:httpmail:datereceived",'+
'"urn:schemas:httpmail:textdescription"'+
' FROM SCOPE(' + "'shallow traversal of "+'"'+$szURL+'"'+"')"

$oConn.ConnectionString = $szURL
$oConn.Provider = "EXOLEDB.DataSource"
$oConn.Open

$oRS.Open($szQuery, $oConn)


While not $oRS.EOF

; Do Something with The Data
;? $oRS.Fields("urn:schemas:httpmail:subject").Value ;Dump the message Subject
;? $oRS.Fields("urn:schemas:httpmail:textdescription").value
;? $oRS.Fields("urn:schemas:httpmail:fromemail").value
;? $oRS.Fields("urn:schemas:httpmail:datereceived").value
;? $oRS.Fields("DAV:href").Value ;Dump the url to the message Item

$url = $oRS.Fields("DAV:href").Value
If not SubSTR($url,InStrRev($url,"."))

;? $url

;If you want recursive subfolders, uncomment this line.
;GetMessages($url,$oconn)
Else
? $url
? $oRS.Fields("urn:schemas:httpmail:textdescription").value

EndIf

$oRS.MoveNext
Loop

$oConn = 0
$oRS = 0
EndFunction



Bryce

Top
#141108 - 2005-06-07 06:49 PM Re: Search the entire exchange server.... all accounts!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Alright! i can keep my title of computer guru here at the company!

here is the move email code! Things are comming toghther

Code:

$1 = "http://<server>/exchange/<userid>/Inbox/testing%20123.EML"
$2 = "http://<server>/exchange/<userid>/Inbox/test/testing%20123.EML"

MoveEmail($1,$2)

Function MoveEmail($source, $dest)
DIM $record, $cdo, $stream
$Record = CreateObject("ADODB.Record")
$CDO = CreateObject("CDO.Message")
$Record.open($source,,3)
$stream = $Record.Fields(-1).Value
$cdo.datasource.openobject($stream,"_Stream")
$cdo.datasource.saveto($dest)
EndFunction



bryce

Top
#141109 - 2005-06-07 07:32 PM Re: Search the entire exchange server.... all accounts!!
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
COMming...
hmm, did you sleep at all last night?
_________________________
!

download KiXnet

Top
#141110 - 2006-04-04 07:25 AM Re: Search the entire exchange server.... all accounts!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Bryce,

What version of Exhange did you do this on? I just had someone come as me to do the same thing.
 

Top
#141111 - 2006-04-04 07:29 AM Re: Search the entire exchange server.... all accounts!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Isn't this a COPYTO not MOVETO ?
 

Top
#141112 - 2006-04-04 02:18 PM Re: Search the entire exchange server.... all accounts!!
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
exchange 2003.

and yes it was a copy, but i am sure that there was a move object as well. I will see what i can find for ya.

Top
#141113 - 2006-04-04 06:23 PM Re: Search the entire exchange server.... all accounts!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Wow, that's a drag. I would expect 2003 to support that and more - I was hoping it was Exchange 5.5 (which is what we currently have).

Well, I suppose I could try it and see though. That way I can see the error of it not running first hand.

Top
#141114 - 2006-04-04 07:05 PM Re: Search the entire exchange server.... all accounts!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Bryce - I ran the code and it did not error out, but I don't find it within my e-mail folders either.

Please stop by or shoot me a PM or IM when you get a chance please.

Top
#141115 - 2006-04-04 07:17 PM Re: Search the entire exchange server.... all accounts!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
arghh... did not work. Forced a bad path on purpose and it still comes back saying no error.
Top
#141116 - 2006-04-05 07:06 AM Re: Search the entire exchange server.... all accounts!!
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11625
Loc: CA
Well after a bit of searching I was able to find the MSS file for Message Store Sanitizer that supposedly can do this as well.


Quote:

Message Store Sanitizer
Version 1.1
Microsoft Premier Support
30 March 1999

Release Notes

What is it?
===========
Message Store Sanitizer is a utility that allows an Exchange Server store to be searched for a particular occurrence of a message and optionally delete it. It has been used with success to remove the "Melissa" virus using a search based on a string in the subject line. Versions are available for both i386 and Alpha platforms.

How does it work?
=================
MSS utilizes standard MAPI calls to enumerate the mailboxes within a designated Exchange container (it will traverse subcontainers by specifying the top-level container), then compare each message in those mailboxes against user-defined criteria. Two modes of operation are available:

Report - Messages that match the criteria are logged to a file, but no deletions occur.
Delete - Messages that match the criteria are logged to a file, and are permanently deleted from the store.

The utility can be set to run in an unattended mode using the Windows NT AT scheduler service.

Parameters are designated in an .ini file (usually named mss.ini).



 
Message Store Sanitizer and related files.
ftp://ftp.microsoft.com/Services/TechNet/Seminars/19990323Troubleshoot_Part_1/Melissa/
 

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1574 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.088 seconds in which 0.039 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org