Wednesday, September 08, 2010

Sunday, September 05, 2010

MSExchangeUM 1038

I was getting a strange MSExchangeUM 1038 error when trying to start MSExchangUM after enabling the UM startup mode to Dual Mode. The error in the event log was: No certificate was found.

Per this technet article, Exchange should automatically retrieve the right certificate - it will even create self-signed certificates if none exist:

But this was not happening for me. Maybe the article is missing a step, but in order to be able to use the certificate, I had to assign the certificate UM capabilities using the command:
Enable-exchangecertificate -tumbprint -services UM

- To get the thumbprint of the cert you need to enable use the command get-exchangecertificate

After this, I was able to start the MSExchangeUM service.

Note: In order for this work with OCS, a cert from a CA trusted by the OCS server(s) and Exchange must be used or the self-signed cert must be installed on the OCS server.


Thursday, February 26, 2009

How to use MFCMAPI

Link to Microsoft's documentation on how to use MFCMAPI:

Sunday, November 02, 2008

Undoing the effects of set-casmailbox

The cmdlet set-casmailbox can be used to configure Outlook Web Access segmentation for individual users. As an example, you can disable the premium client for a particular mailbox through the following command:
set-casmailbox teod -owapremiumclientenabled:$false

However, what happens is that all the other segmentation features get disabled. You can see this by running the following command:
get-casmailbox teod format-list
*** OUTPUT*********************************
OWARemindersAndNotificationsEnabled : False
OWAPremiumClientEnabled : False
OWASpellCheckerEnabled : False
Behind the scenes, the set-casmailbox cmdlet is setting a value on the AD attribute, msExchMailboxFolderSet which controls mailbox segmentation. So, to reset this back to default, set this attribute to $Null, or Not Set either through ADSI Edit or through Powershell. Alternatively, you can enable all the settings by setting the value of msExchMailboxFolderSet to 2147483647.

In production, you should find out what segmentation settings you want for a particular subset of users, configure those settings on one user, and then copy the value from the attribute: msExchMailboxFolderSet, to all of the users that require segmented OWA.

Monday, October 27, 2008

Create Managed Distribution Groups through powershell

I recently had to create 85 managed groups; groups where users manage their memembership (instead of admins). I wrote a powershell script to create the groups, mail-enable them, set the managedby attribute, and associated AD permissions.

I created an csv with the following headings:
Alias , DisplayName, ManagedBy
*The ManagedBy field must contain a DN

Add-PSSnapin Quest.ActiveRoles.ADManagement
[array]$group_info = import-csv "C:\group_info.csv"
$group_info ForEach-Object {
$gname = $_.dispname
$gdesc = $gname
$gAlias = $_.Alias
$gsam = $gAlias
$gmanager = $_.managedby
$gmanager = "CN=De Las Heras\, Teo,CN=Users,DC=Company,DC=org"
#For Debugging, write out the variables (tab delimited)
# Write-Host $gname, `t,$gAlias, `t, $gmanager
$objOU = [ADSI]"OU=Groups,DC=Company,DC=ORG"
$gcn = "cn=" + $gname
$objGroup = $objOU.Create("group", $gcn)
$objGroup.Put("sAMAccountName", $gsam)
$objGroup.Put("groupType", "-2147483646")
$objGroup.Put("description", $gdesc)
$objGroup.Put("displayName", $gname)
$objGroup.Put("mailnickname", $gsam)
$objGroup.put("managedby", $gmanager)
add-qadpermission -service 'servername' $gname -Account 'Company\tdelasheras' -Rights 'WriteProperty' -Property 'Member'

Tuesday, October 21, 2008

Powershell - Get status of Exchange databases

The Exchange Management Shell (EMS) provides a way to output the status of Exchange Databases through the command, get-mailboxdatabase. Note that you must include the -status switch in order to get the proper output.
get-mailboxdatabase select Mounted - will give you nothing.
The correct command is
get-mailboxdatabase -status Select Name, Mounted, LastFullBackup

I have a small script I wrote that get's the status of all the databases in my organization and sends me an e-mail if a database is dismounted. I have the script running as a scheduled task. Here it is:
**Save this a a .ps1 file ** It'll need to be signed as well

function Send-Mail
$SmtpClient = new-object
$MailMessage = New-Object
$SmtpClient.Host = 'relayserver'
$mailmessage.from = ''
$mailmessage.Subject = $sbj
$mailmessage.IsBodyHtml = 1
$mailmessage.Body = $msg
$mailmessage.Body = $msg

function exch-status {
get-mailboxdatabase -status %{$DBName = $_.Name; $DBMounted = $_.Mounted; $DBBackup = $_.LastFullBackup}

if ($DBMounted -eq $False )
$Message = "The database $DBName is unmounted. Please page Sys Admin immediately."
Send-Mail 'Exchange DB Unmounted' $Message ''
$DateToday = Get-Date
if($ -lt $
Message = "It's been 24 hours since a full backup completed successfully."
Send-Mail 'Full Backup has not run' $Message ''

****End of Script ****