Well, I can't remember everything...

Wednesday, 3 February 2016

Stopping the Default Email Address Policy applying to MailUsers and MailContacts, and removing the excess email addresses you accidentally added

The Default Email Address Policy applies to every object in Exchange. This will include any MailContacts or MailUsers you have created. To work around this, try the following:

First, make sure you have an Email Address Policy created for your own users. This will apply to Exchange mailboxes, Resource mailbox and any Mail-enabled groups. This will have a priority of 1

Now for the workaround.

Create a new dummy Accepted Domain

New-AcceptedDomain -Name "External Contacts" -DomainName external.contacts

Now create a new Email Address Policy

New-EmailAddressPolicy -Name "External Contacts" –EnabledPrimarySMTPAddressTemplate "SMTP:%m@external.contacts" -IncludedRecipients "MailContacts,MailUsers" -Priority 2

This will assign the email address alias@external.contacts to any future MailContacts or MailUsers

Now to remove all the additional email addresses from MailUsers and MailContacts you may have accidentally added...

The command below, will remove all email addresses, apart from the primarysmtpaddress

get-mailuser |foreach {set-mailuser -identity $_.identity -emailaddresses "SMTP:$($_.primarysmtpaddress)"}

If you get any permission errors, you need to Enable Inheritance in Security settings of their AD object

You can check to see what email addresses a MailUser has with

get-mailuser | fl identity,primarysmtpaddress,emailaddresses

Now replace get-mailuser with get-mailcontact, and set-mailuser with set-mailcontact in the commands above to complete the process

Wednesday, 3 June 2015

Deleting a Specific Email from all Exchange Mailboxes Using Powershell (eg. Spam, Phishing, Virus)

If your organisation receives a dodgy email, or someone within your organisation forwards one, here is a PS one-liner to delete it from all mailboxes in Exchange 2010

Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery 'Subject:"*Anlieferung Ihrer  Sendung 35171196631*"' -DeleteContent

Obviously, you will need to make sure your search term only targets that specific email. Luckily in the case above, it is a very unique email subject!

It is also recommended to type this command out manually, rather than copying from the page. Single and double quotes can get lost in the translation!

You can preview how many messages will be deleted by replacing -DeleteContent with -EstimateResultOnly

The more mailboxes and emails you have, the longer this will take to complete.

Another useful example is when someone accidentally sends an email to the entire company. This can be used so that the sender and intended recipient still keep their email, but everyone else does not.

Get-Mailbox -ResultSize Unlimited |?{$_.DisplayName -ne "Name of Sender"} |?{$_.DisplayName -ne "Name of Intended Recipient"}|Search-Mailbox -SearchQuery {Subject:"Subject title to search for" AND From:"Name of Sender"} -deletecontent

This does not search any PST files a user has, just their Exchange mailbox

Friday, 20 March 2015

Bad Request - Request Too Long when downloading Skype for Business Preview

If you are getting the error

Bad Request - Request Too Long

HTTP Error 400. The size of the request headers is too long.

when downloading Skype for Business Preview (Office 2016,) use Internet Explorer instead.

Thursday, 6 November 2014

Outlook 2013 IMAP Inbox Empty with Telenor Webmail (

When connecting Outlook to IMAP from Telenor ( the Inbox was empty; only Sent items were available.

This is because Telenor have all the folders under the Inbox. You can see this by right clicking on the Inbox and choosing IMAP Folders. You will then see, Inbox, Inbox.Drafts, Inbox.Sent and so on

To fix this you need to set the Root folder path setting to Inbox

Open Outlook then click on File, Account Settings, then Account Settings again.
Click on your (Telenor) IMAP account and click Change
Click More Settings ... then Advanced
Under Folders it should say Root folder path:
Type Inbox
Click OK and continue to exit out of the dialogue boxes

The Inbox should now synchronise as normal.

Monday, 27 October 2014

Mouse sticking on monitor edges

This will stop the mouse pointer from sticking at the monitor edges, when moving slowly between two monitors. This seems to be happening on Windows 8.1 Update 1, and Windows Technical Preview.

Run regedit
Navigate to HKEY_CURRENT_USER\Control Panel\Desktop
Look for the value MouseMonitorEscapeSpeed
If it doesn't exsist, create a new DWORD value for it

Set the value to 1

Now go to  HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ImmersiveShell

Create a new Key called EdgeUI

Create a new DWORD called  MouseMonitorEscapeSpeed and set the value to 1

Now restart your computer.

This is a per-user setting, so if there are multiple users on a computer, you will need to edit this setting for every user.

Tuesday, 5 August 2014

Changing to ACHI from RAID (Dell T5500)

Replacing 3x SAS disk RAID on a Perc6 controller, with a single SSD connected to the motherboard SATA ports, I needed to perform the following steps; otherwise I would get a BSOD on booting.

Run regedit
Edit the following keys so that the value is 0 instead of 3

(Windows 7)

(Windows 8)



Reboot, then change the BIOS settings in the from RAID to RAID/ACHI Autodetect
Make sure the SATA ports are enabled in the BIOS

Apply the BIOS settings, then reboot.

Monday, 14 April 2014

Test SQL OLE Connection String

A quick way to test or generate an OLE SQL connection string for your application

For example, troubleshooting the following UniFLOW database connection string

Provider=SQLOLEDB.1;Persist Security Info=True;User ID=<some_User>;Password=<some_password>;Initial Catalog=<Database>;Data Source=<SQL_Server>;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096

Log on to the server running the application

Right click on the desktop and choose New -> Text document
Rename the document SQLTest.udl - the UDL extenstion is the important part

Double click the new file and a Data Link Properties wizard should pop up

You can now enter the details of the database server and test the connection

Clicking OK will save the connection string into the SQLTest.udl file. Just open it with Notepad to see the connection string.