POP3, IMAP4, Get-Service and Startup Type

When installing lots of Exchange servers, automation with PowerShell scripting can be very useful. This will ensure you get a consistent platform, and it reduces the chance of errors and misconfiguration.

For a customer I had to deploy 38 Exchange 2013 servers, and they were using POP3 and IMAP4 as well, so these services need to be installed on all Exchange 2013 servers.

By default, POP3 and IMAP4 are not running on an Exchange 2013 server, and the service Startup Type is set to Manual.

You can change the startup type to automatic using the Services MMC snap-in, but for 38 Exchange 2013 servers this isn’t funny anymore.

You can use the Get-Service cmdlet in Windows to retrieve information regarding Windows services, for example:

Get-Service –ServiceName MSExchangePOP3

Or add the Format-List option to get more detailed information:

image

You can use the –ComputerName option to retrieve similar information from another server:

image

There’s all kind of interesting information here, but the most important thing, the Startup Type information is missing here.

To retrieve the Startup Type information you can use the Get-WmiObjectcmdlet and filter on the service name, for example:

Get-WmiObject -Class Win32_Service -Property StartMode -Filter "Name='MSExchangePOP3'"

Please note the single and double quotes in the Filter option!

image

Again, you can use the –ComputerName option to retrieve this information from another server.

image

Note. On an Exchange 2013 (and Exchange 2016) server POP3 and IMAP4 are actually two services. There’s the CAS component (MSExchangePOP3) and the Mailbox server component (MSExchangePOP3BE). These services need to changed independently. The same is true for the IMAP4 service.

You can write a small script to create an overview of all Exchange servers with the Startup Type of all POP3 service, this will look something like:

$Servers = Get-ExchangeServer
ForEach ($Server in $Servers){
$Computer = $Server.Name
$Object = Get-WmiObject –Class Win32_Service –Property StartMode –Filter “Name=’MSExchangePOP3’”
Write-Host $Computer,$Object.StartMode
}

You can change the Startup Type of the POP3 service using the Set-Service command:

Set-Service –ServiceName MSExchangePOP3 –StartupType Automatic

And you can use the-ComputerName to change the Startup Type of a service running on another Server:

Set-Service –ServiceName MSExchangePOP3 –StartupType Automatic –ComputerName EXCH02

More information:

Use PowerShell to Find Non-Starting Automatic Services – https://blogs.technet.microsoft.com/heyscriptingguy/2012/12/18/use-powershell-to-find-non-starting-automatic-services/

Get-Service – https://technet.microsoft.com/en-us/library/hh849804.aspx

Set-Service – https://technet.microsoft.com/en-us/library/hh849849.aspx

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s