Welcome to Powergui.org - an open source community for Windows Powershell

PowerGUI.org PowerGUI.org and blogs

Forums » Request a Script

Thread: Exchange 2003 Script?

This question is not answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 5 - Pages: 1 - Last Post: Mar 5, 2013 6:13 AM by: Art Beane
SAI83

Posts: 2
Registered: 3/5/13
Exchange 2003 Script?
Posted: Mar 5, 2013 2:30 AM
 
  Click to reply to this thread Reply

Hi

Not sure if this is possible, but I have a scenario that id like to fix by a script, here is the scenario

One mailbox sitting on an Exchange 2003 Server, the mailbox receives emails in the following format:

From: External@Contoso.com
To: Internal@Domain.com
Subject:UserX

Any Attachment

UserX is anyone of 700 users at the company, we have five file servers i.e \\london\users\user1
\\portsmouth\users\user2
\\scotland\users\user3
\\wales\users\user4
\\newcastle\users\user5

Users My Documents are assigned via GPO, i.e London Users have there H drive mapped to the London File Server, Portsmouth Users have there H Drive mapped to the Portsmouth File Server.

Attachments are sent via email to one internal address from another external address, with the username who it is intended for in the subject.

What id like to do is create a script that pulls the username from the subject, queries 5 groups in AD i.e (London Users, Portsmouth Users, Wales Users, Scotland Users, Newcastle Users and depending where it finds the user place the file in the users my documents on that file server.

Does this sound possible?

Regards

SI


Martin9700


Posts: 483
Registered: 7/19/12
Re: Exchange 2003 Script?
Posted: Mar 5, 2013 3:40 AM   in response to: SAI83
 
  Click to reply to this thread Reply

The hard part is getting the email data out of an Exchange server. The rest is easy. But I have had this snippet tucked away for awhile, I just haven't had a need yet to try it.

http://slipsec.com/blog/?p=268

Now, of you don't have Exchange that's a whole 'nother issue! Hopefully that gets you started in the right direction.

Martin
www.thesurlyadmin.com
Martin9700


Posts: 483
Registered: 7/19/12
Re: Exchange 2003 Script?
Posted: Mar 5, 2013 4:08 AM   in response to: Martin9700
 
  Click to reply to this thread Reply

Here's another blog where this guy is doing a ton of stuff with Powershell and Exchange.

http://gsexdev.blogspot.com/

Martin
www.thesurlyadmin.com
SAI83

Posts: 2
Registered: 3/5/13
Re: Exchange 2003 Script?
Posted: Mar 5, 2013 5:05 AM   in response to: Martin9700
 
  Click to reply to this thread Reply

Thanks for that some great information there, but both look targeted at Exchange 2007/2010. Might have to bite the bullet and upgrade!


Martin9700


Posts: 483
Registered: 7/19/12
Re: Exchange 2003 Script?
Posted: Mar 5, 2013 5:55 AM   in response to: SAI83
 
  Click to reply to this thread Reply

Sorry, didn't see the Exchange 2003 reference! Since you are running on a 10 year old version of Exchange, I'd say upgrading is a worthy project :D That said, Exchange 2010 is A LOT different then 2003, so study up before you go or get a good consultant.

But to make this work for Exchange 2003 you'll need to install Outlook and then use the Outlook ComObject to get the email. Should be plenty of examples on how to do this on Google.

Martin
www.thesurlyadmin.com
Art Beane

Posts: 760
Registered: 4/23/09
Re: Exchange 2003 Script?
Posted: Mar 5, 2013 6:13 AM   in response to: Martin9700
 
  Click to reply to this thread Reply

Exchange 2003 remote management was provided through WMI. Complex to work with, but not impossible. Here's a pointer to the Exchange 2003 WMI Mailbox Class:

http://msdn.microsoft.com/en-us/library/exchange/aa143732(v=exchg.65).aspx

It's been a very long time since I worked with PowerShell and Exchange 2003 and it looks like I've deleted my script archives from back then, so not much help from here. Hopefully, this you give you something to start with.


Legend
MVP: 2501 + pts
Guru: 2001 - 2500 pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums