An error occurred trying to connect the WSUS server…

WSUS is installed on Windows server 2016 and used for managing Windows Server updates to several of our Exchange servers. This error appeared today and below is what I did to fix it.

When you click on “reset server node”, nothing happens , the error just reappears. Also you will find event id 7032 windows server update services in the event viewer of your server.

Solution:

  1. Open up IIS – internet information services manager on the affected node

2. locate WSUSpool, by clicking on “Application Pools” after expanding the connections tree from the IIS console

You will see the WsusPool status is “stopped”

3. Start the service

4. Now go back to your WSUS console and click on “reset server node” and after a while it should work and all servers can be found again and you can proceed with your windows updates.

PowerShell Script to easily copy a file and rename in new destination

Sharing with you a simple Powershell script I wrote and use to list all the files names and location information for a given folder and then easily copy that TXT file between other folders in the same server.

E.g:- list all files inside myFolderA and export this info to myFile.txt

This will not copy files between remote servers. That requires a more complex method using Invoke-command and remote powershell authentication

To list content of folder


Get-ChildItem K:\myfolderA\*.*| Set-Content K:\myfolderA\myfile.txt

To copy into myFolderB

$From = "K:\myfolderA\myfile.txt"
Copy-Item -Path $From -Destination "J:\myfolderB\newMyfile.txt" -Recurse -Force

$From = This will be the full path of the file you want to copy

Destination – This will be the destination drive and folder for your copied file

Mail.Que database too large

In this article you will learn how to safely delete and recreate the Exchange server queue database file “mail.que”. On deletion of the mail.que file, Exchange will auto create a new mail.que file once you restart the Microsoft Exchange transport service. This applies to Exchange 2010,2013,2016

This action can come in handy, if your mail.que file is getting too large or consuming a lot of space on your disk drive at a critical stage, however, be sure to later properly investigate the root cause of the mail.que file growth as it can reoccur. Some general causes of mail.que file growth can be due to organization wide Exchange transport configurations such as the maxdumpstertime(exchange 2010), safetynetholdtime, pipeline tracing value, etc – For me, the safetynetholdtime value on Exchange 2016 was set to 7 days, which resulted in the growth of mail.que.

By default  your mail.que file location should be at :-  %ExchangeInstallPath%TransportRoles\data\Queue

First, using Exchange powershell we can check the existing size in GB of mail.que, so open up your EMS on the affected Exchange server and run the following:-

Get-ChildItem “D:\Exchange Server\TransportRoles\data\Queue\mail.que” |select name,@{Label=”size”;Expression={“{0:N0}” -F ($_.Length/1GB)}}

screenshot-20190116161259-906x110
screenshot-20190116165503-667x215

To Solve:-

  1. Put your Exchange server in maintenance mode, if you have SCOM etc, or schedule out-of- office hour maintenance before your proceed to perform these actions.
  2. Suspend Microsoft Exchange Transport service, (NOT STOP). This will drain and allow the current messages in the queue to be processed before it stops accepting new messages to the queue. To do this, on EMS run:- Suspend-service -name “Microsoft Exchange Transport”
  3. Run :- Get-queue  – to check and ensure messages in queues are empty (0).
  4.  Do not worry about shadow redundancy queues.
  5. Next, stop the MS Exchange transport, enter :- Stop-service -name “Microsoft Exchange Transport”
  6. Open the mail.que location ( %ExchangeInstallPath%TransportRoles\data\Queue) , select all files inside the folder and delete it, or you can move it to a drive with enough space, you can rename it to something like mail.que.old backup
  7. Now, Start the transport service again, after you have completed above actions. enter:- Start-service -name “Microsoft Exchange Transport”
  8. You will see a new mail.que file is auto created, and your drive space back to normal
  9. Get-queue  – check and monitor and ensure mail flow is back to normal
  10. This will allow you time to investigate more on the root-cause of the growth, check event logs, google, technet articles for more troubleshooting. Good luck.

Tip: use a tool such as Treesize free to get a detailed view of files and the size in your drive. It can come in handy when you want to check the size of files in your exchange server data path.

Managing MailContacts created in Exchange 2007 in our Exchange 2013

Hello,

Today, I will show you how to manage MailContacts in an exchange 2007 / exchange 2013 co-existence scenario and also how to easily migrate your bulk mail contacts from Exchange 2007 to Exchange 2013 , this can also be applied to Exchange version 2010 where you plan to move up to 2013/2016 or when you have co-existence and have to toggle managing MailContacts between the higher and lower Exchange version.

Always Note:-

You cannot use a lower version of Exchange server to modify an Exchange object that was created/upgraded in a higher version of Exchange, and likewise, from a higher version of Exchange you will be first asked to upgrade that Exchange object to a higher version before you can modify it.

Common errors you will face:-

Exchange 2007

Screenshot-20181018122532-446x509

Or via powershell:-

Screenshot-20181018122705-1106x228

From Exchange 2013 powershell when modifying a mailcontact originally created in Exchange 2007 you will get this warning:-

Screenshot-20181018115734-984x220

 

TIP:-  Always check the Exchange version of the object that you need to modify or migrate, this will make things easier..

In powershell you can run:-

Get-recipient mytest@contoso.de | fl exchangeversion, name, externalemailaddress

This outputs the Exchange version – Exchange 2013  0.20 {15.0.0.0} for the external mailcontact menothappy@contoso.de

Screenshot-20181018122425-698x131

You can check the different Exchange versions on Microsoft technet link here  – https://technet.microsoft.com/en-us/library/hh135098(v=exchg.150).aspx

To upgrade/migrate/modify a mailcontact that was created in Exchange 2007, we want to manage this mailcontact in our Exchange 2013 :-

Created in 2007:-

Screenshot-20181018115043-635x567

In Exchange 2013:-

Screenshot-20181018115236-754x338

 

We can run the following commands in Exchange Management Shell in Exchange 2013 to upgrade the mailcontact :-

  1. Get-MailContact ‘Happy, Me’ | fl ExchangeVersion,ExternalEmailAddress
  2. Get-mailcontact ‘Happy, Me’| Set-mailcontact -ExternalEmailAddress ‘mytest@contoso.de‘ -Force:$true
  3. Get-recipient ‘Happy, Me’ -ReadFromDomainController:$true| fl ExchangeVersion,ExternalEmailAddress

 

To do it from ECP Exchange 2013 (read and accept the warning message):-

Screenshot-20181018115401-621x505

Once completed you can now easily manage the mailcontact in 2013. Lets try to change the SMTP email address from mytest@contoso.de to menothappy@contoso.de :-

Screenshot-20181018120854-891x97

We can do it easily, no more warnings no more errors and in future we can easily change/modify/delete the mailcontact from Exchange 2013.

For Migrating mailcontacts in bulk, you can first use the commands I have provided above to gather information for their ExternalEmailAddress , displayname, put them all in a CSV, name the columns ExternalEmailAddress, DisplayName, then add your mailcontacts external emailaddress and their display names.

You can modify the powershell command above to something like:-

Import-CSV “D:\mycontactsbulk.csv” | foreach {Set-MailContact $_.DisplayName -ExternalEmailAddress $_.ExternalEmailAddress -Force:$true}

First test it with 1 contact and get the results and then you can do it in bulk.

Mount Point Icon shown as Folder instead of default Mount drive Icon – Windows server 2012r2

 

Mount point Icon shown as a yellow file folder :-

partitionicon4

Normal mount drive Icon should look like this :-

partitionicon

Solution:-

Make sure when you are creating a mount point, you need to create the mount point folder from the ‘New Simple Volume Wizard’ in disk management of your windows server, once created, do another quick format again after the first quick format during the wizard creation.

partitionicon7

Create a new mount point folder and follow the prompts to complete

partitionicon9

Once it is finished. Perform another quick format manually:-

Screenshot-20181113155003-445x225

Once it is done, your new mount point will appear with the correct mount drive icon :-

partitionicon

I hope this helps anyone who have encountered this issue :D.

Add domains to Internal Relay on Exchange 2010

Here is a quick step to add new domains to your internal relay on Exchange.

If you are not familiar with what internal relay means and what are its impact, you can head over to Microsoft technet and read more:- https://technet.microsoft.com/en-us/library/bb124423(v=exchg.150).aspx#Anchor_2

internaldomains

 

  1.  open up the EMC console and under Organization Configuration >> Hub Transport >> Accepted domains, in the actions menu, select New Accepted domain
  2.  Enter the display name, you can use a different name than the actual accepted domain or for me I prefer to keep it the same.
  3.  Select internal relay domain and save.

Via powershell command:-

new-AcceptedDomain -Name ‘contoso.com’ -DomainName ‘testdomain.com’ -DomainType ‘InternalRelay’

4. To verify that the new accepted domain is working, I usually like to test by sending a test message and then see the results, you can do this via powershell as follows:-

Send-MailMessage -From noreply@newcontoso.com -To “administrator@contoso.com” -Subject “Test internal relay ” -Body “Test only. Do not reply” -SmtpServer “name of your hub server”

View the result from message tracking log:-

Get-MessageTrackingLog -ResultSize unlimited -Start “08/06/2018 9:00AM” -Recipients “administrator@contoso.com” -sender noreply@newcontoso.com -Server”name of your hub server”

This will help you to know immediately if something was wrong with your configuration and you can go back and follow the steps again.

Cannot set the security descriptor of mailbox – Exchange PowerShell error when assigning permissions in Exchange 2010/2016 co-existence

You may come across this error especially if you have not fully migrated all user mailboxes to your new exchange 2016 servers, or you have a co-existence 2010/2013 or 2010/2016, and you still have to resolve help desk calls for those users not yet migrated or those who just got migrated.

Screenshot_1

“Cannot set the security descriptor of mailbox…….. in exchange mailbox database ……..”

Below command was executed to grant full access permission to userB on userA mailbox:-

Add-MailboxPermission -Identity “userA” -User “userB” -AccessRights FullAccess -InheritanceType All

And we got the error described above.

Cause:-

Powershell is throwing this error because the mailbox that you are trying to add the permission is hosted in a higher version of exchange than the server you are running the powershell command from.

That means you should be running the command in Exchange 2016 where the mailbox of userA is now hosted after it was migrated from Exchange 2010.

Solution:-

  1. Check which database the mailbox is currently on, and which version of Exchange server.

Get-Mailbox -Identity UserA | fl database,exchangeversion

2. Use powershell on a higher version of  exchange where the mailbox resides. In my case it is exchange 2016 powershell, it depends on your Exchange version result which you will get by running the command above.

You can always refer to this Microsoft technet link to know your versions of Exchange 🙂 https://technet.microsoft.com/en-us/library/hh135098(v=exchg.150).aspx