Category Archives: Powershell

Configure and Test SMTP for Office 365

After done about 60+ Office 365 migrations, I’ve noticed that almost all customers have Applications, Multi function printers or other devices that send some kind of email to end-users or suppliers/Customers.
These devices normally use the SMTP-Protocol.

To make sure that the emails is sent secure, Microsoft recommend to Authenticate the Application or Device which is going to send email.

I always recommend the customers to create one or several specific Office 365 Accounts with a Exchange Online license.This way you can set password never expire and choose a complex password with 16 characters.

Configure the Application or Device with the following settings:
SMTP Server:
Encryption/TLS: YES
Port: 587
And of course, make sure to enter the specific account under username and password.

Can I test the SMTP connection?

Of course you can test the connection and the credentials before you deploy this solution.
I’ve created a simple Powershell script that can test this:

$smtpcred = Get-Credential
Send-MailMessage –From –To –Subject “Testing SMTP” –Body “This email is sent from Office365 SMTP server for test purpose” -SmtpServer -Credential $smtpcred -UseSsl -Port 587

This script can come in handy when some customer call you to report that the email from the Applications/Devices isn’t working correctly. You can test the connection and the credentials easily.
Make sure that you change the mail-addresses, the Subject and Body after your needs.

not all application and devices have support for TLS and or to use specific credentials when sending mail through smtp servers.
To solve this, you might need to install a SMTP relay server in your server-infrastructure.


For more informations about other solutions and limits, visit Technet

Office 365 – Shared mailbox sync issues

I have been using shared mailbox for the majority of customers running Office 365 for a long time.Its a great way to create a mail-structure for different type of groups in an organisation.

For exampel,, so on and so forth.
This is completely free, but to access this “Shared mailbox” you need an Office 365 account with an valid license and a outlook 2010+ client installed.

However, i’ve seen a couple of issues with “Shared mailbox” as well.
Several customers have reported that they don’t get regular updates in the shared mailbox. In some case, the mailbox is not updated in several days for some users.

This is a known issue, its a bug in the “Automapping” function that make the shared mailbox automapp in the outlook client.

Here is one way to solve the issue:


Step 1:

Remove the users “Full permission” to the “shared mailbox” witch isn’t syncing.

Step 2:

Make sure the “Shared mailbox” disappears from the users outlook client.
(You might speed up the process by restarting outlook.)

Step 3:

Disable the automapping function and add FullAccess to the specific shared mailbox through powershell:

Add-MailboxPermission -Identity “shared mailbox name” -User ‘Users name’ -AccessRight FullAccess -InheritanceType All -Automapping $false

Step 4:

Add the shared mailbox manually through the following steps:

Right-click on your main account and select “Data file properties” -> “Advanced” -> “Advanced” -> Press “Add” and type the emailadress of the “shared mailbox


The mailbox will now start to sync as it should.
Be aware of “Use cached exchange Mode” This might take up alot of disk space in the user profile disk or on C:\ depending on setup and environment.

Getting Started with Nano Server

The next generation of Windows server is soon to be released, the final release date is estimated to Q2/Q3 2016.

Windows server 2016 is very exiting and will for sure change things up the way we administer servers.
Microsoft have added a new installation mode in Windows Server 2016. Nano Server.

Nano Server is truley a “Core Server”. It will not include the option to install GUI, you will not be able to logon to the server localy or through RDP.
This make it possible to build the microsoft OS on a completely new minimal level than before.
All management will be handeld remotly through WMI/Powershell.

Several microsofts enginners claims that the Nano server will require up to 80% less reboots.
This thanks to the servers will not contain any gui,it will have fewer services and processes running and it will require less critical patches.

Checkout some information from Teched’s great video at:

Lets go!!

Its time to get familiar with the new Windows Nano server.
Im going to run a Nano Server as a VM in my test-enivoroment. Here is how to get started:

Step 1:

Download the Windows Server 2016 TP4 at:

Be sure to login and registry for the evaluate copy.

Save the .ISO file to C:\TEMP\NanoServer



Step 2:

Now its time to download all powershell scripts needed

Download the script “Create a New Nano Server VHD/VHDx” from Script center
Save the .ps1 script to C:\TEMP\NanoServer


You will also need the Convert-WindowsImage.ps1 from
Save the .ps1 script to C:\TEMP\NanoServer

This becuase there is currently a bug in the orgiginal Convert-WindowsImage.ps1 that causes the TP4 not to work as it should.

Now you should have the thease files under C:\TEMP\NanoServer


Step 3:

Now it´s time to start the accual making of the .vhd file:

Start powershell ISE as Administrator

cd to C:\TEMP\NanoServer

Paste the following script and edit it how you would like to have the settings:

.\New-NanoServerVHD.ps1 `
-ServerISO ‘c:\temp\NanoServer\10586.0.151029-1700.TH2_RELEASE_SERVER_OEMRET_X64FRE_EN-US.iso’ `
-DestVHD c:\temp\NanoServer\NanoServerTP4_C.vhd `
-ComputerName NanoServerTP4 `
-AdministratorPassword ‘Secr3Tp@ssw0rd’ `
-Packages ‘OEM-Drivers’,’Guest’ `
-IPAddress ‘’

The .vhd file is now beeing created with the specifics above.


Now when you have the .vhd file ready, you only need to create a new GEN 1 vm and attach the .vhd disk, and then youre all set to start using Windows Nano Server!

This is how Nano Server looks through the Console in Hyper-V:



Connect to the Nano server through powershell:

# Enable powershell remoting
Enable-PSRemoting -Force

# You might want to change * to the name or IP of the machine you want to connect to
Set-Item “wsman:\localhost\client\trustedhosts” -Value “*” -Force

# Credentials
$creds = Get-Credential servername\Administrator

# Enter PSSession, you must change “ServerAddress” to the name or IP you want to connect to
Enter-PSSession -Computername -Credential $creds


Some (hopefully) basic usable powershell scripts:

Allowing ICMP trafic in the Nano firewall:

# Enable ICMP on Nano Server

# Start by importing the NetSecurity Module
Import-Module NetSecurity

# Create a new Firewall rule that will allow ICMP
New-NetFirewallRule -DisplayName “Allow ICMP” -Direction Inbound -Action Allow -Protocol icmpv4 -Enabled True

# Controle that the new firewall rule is listed in the rules list
Get-NetFirewallRule -DisplayName “Allow ICMP”



Allowing SMB browsing to the Nano Server:

# Enable SMB browsing on the Nano Server

# Start by importing the NetSecurity Module
Import-Module NetSecurity

# Create a new Firewall rule that will allow SMB Sharing
Set-NetFirewallRule -DisplayGroup “File And Printer Sharing” -Enabled True






More about the Nano Server: