Tag: Exchange
Adding MIME types to IIS 6
by Brian on Jan.05, 2010, under Windows Info
Recently, a client had issues with Office 2007 documents turning (supposedly) into .zip files.
Apparently, the .docx and .xlsx formats are actually compressed XML files, and when IIS doesn’t have a MIME type for them in the MIME map, it passes them through as .zip files. This is problematic, to say the least.
When this happens, you can run the following script against the web server, and add the necessary MIME types to the map.
The original article where the script was found is here.
' This script adds the necessary Office 2007 MIME types to an IIS 6 Server.
' To use this script, just double-click or execute it from a command line.
' Running this script multiple times results in multiple entries in the
' IIS MimeMap so you should not run it more than once.
' Modified from http://msdn.microsoft.com/en-us/library/ms752346.aspx
Dim MimeMapObj, MimeMapArray, MimeTypesToAddArray, WshShell, oExec
Const ADS_PROPERTY_UPDATE = 2
' Set the MIME types to be added
MimeTypesToAddArray = Array(".docm", "application/vnd.ms-word.document.macroEnabled.12", _
".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", _
".dotm", "application/vnd.ms-word.template.macroEnabled.12", _
".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", _
".potm", "application/vnd.ms-powerpoint.template.macroEnabled.12", _
".potx", "application/vnd.openxmlformats-officedocument.presentationml.template", _
".ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12", _
".ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", _
".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow", _
".pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12", _
".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", _
".sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12", _
".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide", _
".xlam", "application/vnd.ms-excel.addin.macroEnabled.12", _
".xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12", _
".xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12", _
".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", _
".xltm", "application/vnd.ms-excel.template.macroEnabled.12", _
".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template")
' Get the mimemap object
Set MimeMapObj = GetObject("IIS://LocalHost/MimeMap")
' Call AddMimeType for every pair of extension/MIME type
For counter = 0 to UBound(MimeTypesToAddArray) Step 2
AddMimeType MimeTypesToAddArray(counter), MimeTypesToAddArray(counter+1)
Next
' Create a Shell object
Set WshShell = CreateObject("WScript.Shell")
' Stop and Start the IIS Service
Set oExec = WshShell.Exec("net stop w3svc")
Do While oExec.Status = 0
WScript.Sleep 100
Loop
Set oExec = WshShell.Exec("net start w3svc")
Do While oExec.Status = 0
WScript.Sleep 100
Loop
Set oExec = Nothing
' Report status to user
WScript.Echo "Microsoft Office 2007 Document MIME types have been registered."
' AddMimeType Sub
Sub AddMimeType (Ext, MType)
' Get the mappings from the MimeMap property.
MimeMapArray = MimeMapObj.GetEx("MimeMap")
' Add a new mapping.
i = UBound(MimeMapArray) + 1
Redim Preserve MimeMapArray(i)
Set MimeMapArray(i) = CreateObject("MimeMap")
MimeMapArray(i).Extension = Ext
MimeMapArray(i).MimeType = MType
MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapArray
MimeMapObj.SetInfo
End Sub
Recreating the Exchange 2007 OWA Virtual Directories
by Brian on Aug.19, 2009, under Windows Info
Sometimes, too many people have messed with it.
Plain and simple.
People like to check boxes. And enable/disable things. it’s fun.
But when it’s your CAS server, it can be a real hassle to navigate the IIS interface, and reset all of those little “tweaks”, placed there by someone with apparently no business “tweaking” IIS.
You know who you are.
;P
In these cases, it’s much easier to let Exchange do it for you, and all you need to open is the Exchange Management Shell.
This will list all the current OWA-related virtual directories.
get-owavirtualdirectory
This will delete the OWA virtual directory for the Default Web Site.
remove-owavirtualdirectory -identity "owa (Default Web Site)"This command will re-create the owa virtual directory under the Default Web Site in IIS.
new-owavirtualdirectory -OWAVersion "Exchange2007" -Name "owa (Default Web Site)"
This command will re-create the “Exchange” virtual directory under the Default Web Site in IIS.
new-owavirtualdirectory -OWAVersion "Exchange2003or2000" -VirtualDirectoryType "Mailboxes" -Name "Exchange (Default Web Site)"
When you run this command, if you get an error similar to the one below, it is possible that IIS is set to work in 32 bit mode and not the required 64 bit mode.
New-OwaVirtualDirectory : An error occurred while creating the IIS virtual directory ‘IIS://mailserver.yourdomain.com/W3SVC/1/ROOT/owa’ on ‘mailserver’.
At line:1 char:24
+ New-OWAVirtualDirectory <<<< -OWAVersion "Exchange2007" -Name "owa" -Website "Default Web Site"
To make IIS run in 64 bit mode, run the following in an administrative command prompt:
cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 0Testing Exchange IIS/OWA/OMA Connectivity
by Brian on May.20, 2009, under Windows Info
I found this *AWESOME* website while testing an Exchange 2007 server for an ActiveSync issue. Thanks, Microsoft!
https://www.testexchangeconnectivity.com/
“Send-As” from Outlook 2007 on Exchange 2007
by Brian on Feb.08, 2009, under Windows Info
For this particular exercise, let’s pretend that you are, once again, named Bob. You work for TailswimToys.com, and they use a Microsoft Windows
Small Business Server 2008, running Exchange 2007 for email and collaboration services. You use Outlook 2007, and are very happy with it overall.
All of your customers know you as bob@tailswimtoys.com [eat that, spammers... ;) ]
Recently, TailSwimToys experienced a huge economic windfall, and acquired Fabrimak.com, whose main business model is appearing in test questions, under an altered name.
Anyway, bob@fabrimak.com needs the ability to communicate with Fabrimak’s customer base without letting them know that he is *also* bob@tailswimtoys.com, which they would view as silly, thus undermining their confidence in Bob. (And Bob’s company)
In order for Bob to send an email from an address other than his default email address, you need to do the following:
Note: You may want to stop all inbound email services while you do this. This way, anyone sending email to an address that you’re moving to a distribution group will not bounce, but will sit on their mail server in the retry queue, and will be delivered after you’ve created the group, and re-started the inbound mail services. (typically, you’ve got 12 hours before an email will expire from the queue and cause a NDR.)
This assumes that you’ve already configured your Exchange server to accept email for the Fabrimak.com domain, and all necessary DNS records have been created, as these are beyond the scope of this post.
First, open the Exchange Management Console, and delete all but the default email address from the user’s mailbox. (leave bob@tailswimtoys.com in there, this will be the email address used when Bob doesn’t specify an outbound address.)
Next, remove the Recipient Update Policy setting from the user’s mailbox in the Exchange Management Console. This is necessary so that the alternate addresses aren’t re-applied to the mailbox on the next run of the Recipient Update Service.
Then, create a Mail-Enabled Distribution Group named bob@fabrimak.com, and apply the secondary email address to it. (in this case, bob@fabrimak.com) Make the user Bob a member of this group. Also, you’ll need to grant Bob “Send-As” permissions to the Mail-Enabled Distribution Group, so he can “Send-As” from the Group. Another thing you’ll need to do is remove the Recipient Update Policy setting from the Mail-Enabled Distribution Group, as it’s enabled by default.
After these configuration changes, Bob will be able to compose a new email, select to show the “From:” field in Outlook, click “From:”, and select the Mail-Enabled Distribution Group named “bob@fabrimak.com”, and that is the only address for Bob that the receiving party will see.


