Managing Mail in Exchange 2007

Publicity isn’t everything. Or at least that’s what one of the greatest innovations ever to come out of the Microsoft camp has taught us.  PowerShell, by far one of the most powerful tools ever put into the computing public’s hands and the recipient of nothing but “stellar” press, seems to be nothing but a mere curiosity to most techs out there.  In fact, along with admitting that I myself rarely get a chance to jump in and use it, I do not know one single server administrator who regularly uses PowerShell in an any useful capacity whatsoever. It is a real shame!

But, this article isn’t on PowerShell itself if you will, rather it is just an introduction to one of the many uses of PowerShell which are wrapped into a tool called the Exchange Management Shell.  What a lot of people don’t realize is that the Exchange Management Shell itself is fully based on PowerShell and any of the methods called from within it, can also be accessed in almost exactly the same fashion from within PowerShell itself.

Obviously, this blog post cannot be exhaustive. But I will provide you with one very common and useful example of this utility and give you the links needed to go out and tailor this to your own unique Exchange environment. Literally, this tool opens up unlimited possibilities to managing mail and can be tailored to do anything you can dream of.

So, I know the one thing I face very often as an Exchange administrator is questions and requests about exporting mail. In the past, we might have used a tool like Exmerge to export these mailboxes – which actually worked well and was more than adequate – but there was always something that it couldn’t quite do that would have made your job easier.

Well, PowerShell and the Exchange Management Shell can now do exactly this.

So, let’s take a real life example. You want to export all of the mailboxes in exchange into some PST files that can be archived and kept for future use.

So, the simplest of commands that could be run would be as follows:

get-mailbox | Export-Mailbox -PSTFolderPath C:\PSTFiles\

 

This, as can be easily inferred from the command itself, simply exports everything as PST into the directory specified.  Now, to do more with this, simply add to the above parameters as necessary, for example you could run:

get-mailbox | Export-Mailbox –ContentKeywords “litigation” -PSTFolderPath C:\PSTFiles\

So now, we have refined the export a bit and it will only export those items that have the Keyword “litigation” somwhere within the body of the mesage.

The list of options and the ability to pipe output from one cmdlet into input in another is staggering. Mastering this tool, will definitely put you in the ranks of the top-paid excchange administrators.

Now, I think I have whetted your curiosity, so here are some links to allow you to start to master this tool.

http://technet.microsoft.com/en-us/library/aa998579.aspx – This is specific to the export command we looked at in our example.

http://technet.microsoft.com/en-us/library/aa998225.aspx – This is a general overview of all of the cmdlets available fpr the Exchange Management tools.

Now, hope you have fun with this. The more you get into it, the more fun it all becomes.

Cheers!!!

UAC and Your Application

Okay, so there’s this snarky little asshole who thinks he can tell me what to write.  “Go write a UAC Manifest article”, he says.

FINE!

There won’t be much too it, of course, which is a good thing – it’s easy to understand, easy to implement, and works as intended.  Of course, this is all assuming you’re using Visual Studio 2008.  If not: time to upgrade, chump!

So, you’ve written this wonderful little application does that wonderful little things.  You’ve tried it on XP, and it works perfectly.  Ditto for Windows 2000.  It crashes horribly on Windows ME, but that’s okay – so does everything else.  But on modern versions of Windows – Vista, 7, Server 2008 – things get weird.  Luckily, you’re a bad-ass hardcore cowboy coder who instantly knew you were running into UAC issues.  Solution: “Run as Administrator”.  Done!

But wait a minute… look at some of those fancy Microsoft programs like mmc.exe that automatically ask to run as an administrator.  How’d they do that?  Well, as a loyal Slick IT reader, you no doubt already read our article on UAC and Application Run Levels, right?  So you already know that you can configure your application to run in one of three ways:

RunAsInvoker: Runs as a standard user (unless the user has UAC turned off or chooses Run As Administrator somewhere along the line).  You’ll never get a UAC prompt.  Consider this “Never Elevate”.

RunAsHighest: Runs with the highest privileges the current user has.  For Standard users, the program will just run.  For Administrators, the program will run elevated, with a UAC prompt if needed.  Consider this “Elevate If Possible”.

RunAsAdmin: Always runs elevated.  A UAC prompt will be shown (unless the user is already elevated), and Standard users will be asked for Administrator credentials.  Consider this “Always Elevate”.

There’s actually a third option, and this is what’s used for running older programs.  If you don’t specify any of the above, Windows assumes your program doesn’t know about UAC and handles everything for you.  This includes File and Registry Virtualization.  Meaning, if your program tries to write to an area like C:\Program Files, it will appear to succeed.  In actuality, Windows virtualizes these changes under the current user’s account but keeps the actual Program Files folder unchanged.  I’ll write more on this virtualization later.

Here’s how you configure your application to use one of these run levels:

  1. From Visual Studio, choose Project, Add New Item:
    image
    Keep the default name and just click Add.
  2. Replace the blue “asInvoker” (towards the end of the file) with “requireAdministrator” or “highesetAvailable” if you really think you need to.
  3. Save, run, celebrate.

Fine, fine.  But how do you make your application elevate when the user clicks your snazzy Options button with the UAC Shield icon?  Simple: you don’t!  That is to say, your application is either elevated, or it isn’t.  This is determined before a single line of code is executed.  The only ways to get around this are to either launch a separate .exe that contains your options dialog and has “requireAdministrator” set, or restart your main .exe as an administrator.

Pain in the ass?  You bet!  Life would be so much easier if everybody just ran everything as Administrator all the time.  And while we’re at it, let’s abolish passwords, too… those can also be a pain in the ass.

Blackberry Controller Service Won’t Restart

 

So, today at work I finally came across this beast.  I had actually heard of the issue before, but had never actually come face-to-face with it and stared it in the eye. Error 5003…..

The Blackberry Controller Service, the service that is supposed to monitor and restart other failed Blackberry services, wouldn’t start no matter how many  times I tried to manually start it.  Useful, isn’t it.

Fortunately, the fix is extremely simple.  Simply go to your DNS Server service and stop it. Go to your Blackberry Controller Service and restart it and then head back to DNS and restart it. Voila….all better.

But, here’s the kicker. This issue is actually caused by a MS Patch and will resurface on every reboot. Apparently DNS will block some ports that the controller needs to function and these will always be closed upon the service restarting, so port reservations actually have to be made in the DNS Server service to prevent this.

This can be done by referencing

http://blogs.technet.com/sbs/archive/2008/07/17/some-services-may-fail-to-start-or-may-not-work-properly-after-installing-ms08-037-951746-and-951748.aspx

Simply add ports 4070 and 4071 to the reserved list and your problem is gone forever.

Now if only we could get RIM to take responsibility for its crappy coding to begin with start making software that just worked instead of the buggy amateurish shit that they force upon us now.

That’s my rant and fix for the day!

Cheers!

IE8 Slow – An addendum to tweaking IE8

As an additional item to the tweaking IE8 blog post, one tweak that has become increasingly popular on  the net involves downloading and installing a package often referred to as the DelDomains package.

While this fix likely won’t do anything for those of you with a fresh install of IE8 on Windows 7 and probably with Windows Vista, it is very likely to help people that have upgraded to IE8 on a crusty old XP box. The reason for this is simple – spyware.

Being that XP was so prone to so many types of malware, most people at one time or another installed programs such as Spybot or Adaware. These programs actually worked very well at controlling and removing spyware and part of this was through the clever use of IE7s security zones. These programs would literally add hundreds of rogue domains to the “blocked” list in IE7 effectively stopping further infection.

When upgrading to IE8, Microsoft, as it rightly should, leaves these browser specific settings alone and imports them into the new IE8 install. However, IE8 seems to deal with these entries in a different fashion than its predecessor which results in a long delay for some – especially while launching the browser. Further to this, the browser doesn’t actually need these sites listed in this fashion anymore as IE8 has an enhanced security regime, which renders this method of blocking unnecessary.

To download the tool, right click here and save the tool to your desktop. Then right click on the file to install.

This tool will delete all of the sites listed in your trusted, enhanced security configuration and restricted zones. Any trusted zones that you have set up yourself will have to be re-added.

This tool has been shown to greatly improve launch time for many.

While on the same topic….there is one tweak that likely won’t help you if your Internet Explorer is working but slow.

Some people have reported that re-registering actxprxy.dll gave their browser a speed increase. Unfortunately, there can be no truth to this.

actxprxy.dll is a file that is automatically registered during the IE8 install and without it IE8 will not even open. Re-registering an already registered file, while doing no harm, will do nothing to your system. This tweak is unfortunately not legitimate. However, if your IE8 install is not opening at all, you could try running regsvr32 actxprxy.dll from an elevated command prompt and this may fix the issue.

Anyway, hope this tip helps.

Cheers

Microsoft’s Last Chance

The last few years have been brutal for Microsoft. With ad campaigns from that other company openly slashing Microsoft in a virtual flurry of half-truths, misinformation and innuendo, and its flagship OS almost universally loathed despite its obvious technical superiority to Windows XP, Microsoft needs a win.

But Microsoft’s biggest competitor isn’t Linux, Mac or any other operating system on the verge of becoming mainstream. Nope, it is Windows XP and Microsoft needs to convince those running the 8-year-old operating that the time has finally come to replace it. In fact, an estimated 71 per cent of businesses still use XP to conduct business and a large portion of these have openly stated that they have no plans to upgrade to Vista. But, then again, why would they?

Just two weeks ago, Bill Veghte, Microsoft’s senior vp for Windows business, told enterprise class businesses that if they have just started testing Vista for deployment, they should instead switch to the Windows 7 release candidate and skip Vista entirely.

Clearly, Microsoft has started to understand the position they are in. Let’s face it – Windows Vista, with all of the negative press it received in its infancy, can never recover despite the “thousands of improvements” its service packs have provided.  Truthfully, Windows 7 isn’t so different from its predecessor architecturally, but its fit, finish, and polish, and the manner in which it is being rolled out, seems to point to it being a winner.  The addition of Windows XP virtual mode is a nice addition too, just to bring those sitting on the fence onboard.

Should Windows 7 not workout for Microsoft, their future would appear to be fairly bleak. One has to ask the question – where are those 71 per cent of businesses to go? No Vista? No Windows 7? No additional revenue from Windows XP??

Unfortuantely, no one has the answer here, but with the increasing strength of companies like Google and their cloud computing initiatives, aggressive advertising by Mac, and the aura of strength radiating out of the Ubuntu camp….I would say Microsoft only has one last go at the game!


Copyright © 2010 Paul Guenette and Matthew Sleno.