Connect to Exchange Online

On your local computer, open Windows PowerShell and run the following command –

$UserCredential = Get-Credential

In the Windows PowerShell Credential Request dialog box, type your Office 365 user name and password, and then click OK.

Run the following command –

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Then run the command –

Import-PSSession $Session

You need to connect to the Microsoft Online Service for a number of operations. To do so run the following command using the credentials you input as above –

Connect-MsolService -Credential $UserCredential

Once you have finished with the session run the command –

Remove-PSSession $Session

OWA – Silent Redirection to Office365

If a user’s mailbox is in Office 365, the CAS server issues a redirect to Office 365 when the user has successfully authenticated. By default, it pops up a nuisance, interstitial page that requires an extra click (and can turn into a black hole),
This is avoided by adding the following code to C:/Program Files/Microsoft/Exchange Server/V14/ClientAccess/Owa/casredirect.aspx immediately above the line <!DOCTYPE HTML…

<%
if (RedirectionUrl.Contains(“http://outlook.com/owa”)) {
Response.Redirect(RedirectionUrl);
Response.End();
}
%>

You need to do this every time there is an update to the Exchange software.

Checking and De-listing Mailhubs Blacklisted by Hotmail/Live

Login at https://login.live.com/ with a valid hotmail/live account. I have set up the account cmc-qub@hotmail.com for this. Make sure you know the password (ask Clive McDowell).

Once you have logged in open another browser tab and go to https://postmaster.live.com/snds. The useful links are –

  1. View Data: summary report on host IP addresses with historical data going back possibly months.

  2. View IP Status: gives a list of any IPs that are blacklisted.

  3. Request Access: allows you to add IP addresses or address ranges to be included in the reporting.

The other links should be self-explanitory.

If one of the IPs is blacklisted go to this link http://go.microsoft.com/fwlink/?LinkID=614866 and fill out the form. You will usually get an automated response fairly quickly but it’s really up to them how soon they take any action. In recent times it has only been a few hours.

Exchange 2010 Failed Database Content Indexes

Failed content indexes can easily go unnoticed when everything else is working fine however they will eventually begin to cause problems for you, for example by preventing database switch overs. You can list all failed indexes with the following command –

[PS] C:\>Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”}

If any databases are listed the indexes can be fixed by piping the output from the command above into the Update-MailboxDatabaseCopy cmdlet as below –

[PS] C:\>Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”} | Update-MailboxDatabaseCopy -CatalogOnly

Once this has completed run the first command again. It should not return anything if successful.

Message Tracking

Use EMS commands to retrieve message tracking data across several hub transport and mailbox server hosts as follows –

Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true} |`
Get-MessageTrackingLog -sender "j.blogs@qub.ac.uk" -Start "7/28/2012 8:00AM" -End "7/28/2012 5:00PM"

 

This is a split one-line command so watch out for the trailing back-tick!

Check help on the Get-MessageTrackingLog commandlet for other switch options e.g. trawl for recipients, message ID etc.

From Pegasus to elsewhere

A user recently had the desire to move away from the email client they’d been using for some time, and had requested assistance. In this case, they were using a version of Pegasus (Version 4.6, I think). Vaguely recalling that you can import  data from various email clients to Thunderbird, I looked for a tool to convert the folders in the /Mail/ directory for Pegasus to something Thunderbird would use. Having read a little about it, I knew I needed to find a way to convert the folders to .mbx files, and found one called Mail System Converter here. It was then possible to move the folders and retain the email in a new client, or move it to an account on a server.

First install Thunderbird, and then add an IMAP account using your credentials. Having made sure this is connecting correctly, close down Thunderbird.

Using Mail System Convertor, you can use the ‘Folders’ menu, then select ‘Export from Pegasus’ to create files usable by Eudora. Having done so, simply move these .mbx files to:

C:\users\<yourusername>\AppData\Roaming\Thunderbird\Profiles\<random>.default\Mail\Local Folders\

Open Thunderbird again, and you can now see these as local folders. If you so wish, you can now drag them to your email account on your server.

Exim on Centos

The version of Exim that comes with rpmforge is currently 4.63 which is somewhat lower than the latest version. Rpms for the latest version (currently 4.77) is available from atrpms. Create the file /etc/yum.repos.d/atrpms.repo on any target machine and add the following content –

[atrpms-stable]
name=Centos $releasever – $basearch – ATrpms
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/stable
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1
includepkgs=libspf2* libsrs*

[atrpms-testing]
name=Centos $releasever – $basearch – ATrpms
baseurl=http://dl.atrpms.net/el$releasever-$basearch/atrpms/testing
gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms
gpgcheck=1
enabled=1
includepkgs=exim*

To update exim simply run yum update exim

CMS – NHS problem

There is a problem which seems to occur mostly on Mondays when a user connects from the NHS gateway {IP 81.145.165.2}. This is causing some threads of the java process that runs sitemanager to hang while still consuming CPU cycles. The system can operate with 1 of these as its a dual CPU server but once there are 2 or more of these then the service will degrade steadily.  There is a case raised with Terminal 4 who are investigating but in the meantime they advise restarting tomcat. The user interface will keep running for up to an hour but as publishing slows down and these back up then the perfomance will fall off. The rsync to the live server is badly affected as well. These gradually build up. The nagios service can also be used to view the problem. Look under “Apache Status” and select the entry”CMS tomcat” or go directly to http://cmst4.qub.ac.uk:8080/manager/status

The cpu guzzling processses will be obvious, but check with top.

There are 2 possible actions 1. restart tomcat 2. renice java and keep it running for a while  (I would do this if its 4.30 keeping things ticking over until after 5.00 and then restart tomcat}

1. restart tomcat

{on jackie}
ps -ef | grep java
kill -9 {java process id}
rm /usr/local/tomcat/temp/catalina.pid
/etc/init.d/tomcat start

2. change priorities

ps -ef | grep java
renice +19 {java process id}
renice -19 {process ids of the rsync process}

Also of note is that the NHS gateway can be blocked by adding the following line immediately under the input directive to the iptables config. in /etc/sysconfig:

:INPUT ACCEPT [0:0]
-A INPUT -s 81.145.165.2 -j DROP

There is a copy of the iptables file with this line included called iptables-hsblock. This is a measure of last resort as it also blocks NHS staff accessing an eform which they are using at present to register for a workshop.

Cache root file systems

The root filesystem on the squid cache server marge can become full due to a couple of temporary files in /var/tmp growing very large. These files can only be cleared when squid is stopped, the following commands will help solve this:

/usr/local/squid/sbin/squid -kshutdown
/usr/local/squid/sbin/squid -f /usr/local/squid/etc/squid-qub.conf  -kshutdown
ps -ef | grep squid | grep -v dns # check for the active squid processes
tail -f /usr/local/squid/logs/access.log # check activity on the service
tail -f /usr/local/squid/logs/cache.log # watch for the squid shutdown message – takes 30secs
rm /var/tmp/UR_COUNT_ALL
rm /var/tmp/UR_COUNT_ALLTCP
rm /var/tmp/UR_COUNT_ALLUDP
/etc/rc.d/rc3.d/S98squid start
/etc/rc.d/rc3.d/S98squid_qub start