Posted On July 13, 2019

PowerShell: Script to Stop, Start, Disable, and Enable Exchange Server

kimconnect 0 comments
blog.KimConnect.com >> Codes , Windows >> PowerShell: Script to Stop, Start, Disable, and Enable Exchange Server
<#
This script contains a set of functions to administer Exchange 2010, 2013, 2016, and 3000. However, it will not control Lotus Domino, Open Xchange, or Zimbra.

Usage: paste this into an elevated PowerShell session of an Exchange server. Then, run one of these commands:
- stopExchange
- startExchange
- disableExchange
- enableExchange
#>

$exchangeServices=Get-Service | Where-Object {$_.DisplayName –like "Microsoft Exchange *"};

function stopExchange{
net stop msexchangeadtopology /y
net stop msexchangefba /y
net stop msftesql-exchange /y
net stop msexchangeis /y
net stop msexchangesa /y
net stop iisadmin /y
net stop w3svc /y
$exchangeServices | Stop-Service -Force;
}

function startExchange{
net start "World Wide Web Publishing Service"
net start "Microsoft Exchange Information Store"
net start "Microsoft Exchange Unified Messaging"
net start "Microsoft Exchange Transport Log Search"
net start "Microsoft Exchange Transport"
net start "Microsoft Exchange Throttling"
net start "Microsoft Exchange Service Host"
net start "Microsoft Exchange RPC Client Access"
net start "Microsoft Exchange Replication"
net start "Microsoft Exchange Mailbox Replication"
net start "Microsoft Exchange Mailbox Assistants"
net start "Microsoft Exchange EdgeSync"
net start "Microsoft Exchange Anti-spam Update"
$exchangeServices | Start-Service;
}

function disableExchange{
stopExchange;
$exchangeServices | Set-Service –StartupType Disable;
$exchangeServices | Get-Service | select -property name,starttype
}

function enableExchange{
$exchangeServices | Set-Service –StartupType Automatic;
$exchangeServices | Get-Service | select -property name,starttype
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

SAN Dell Equallogic PS6100E

Per documentation: Port density requirements to support fully redundant configurations and maximum SAN throughput for…

PowerShell: Remove a Scheduled Task By Name

# removeScheduledTask.ps1 # Set CoomputerNames $computerNames='sherver0001','sherver1000' $scheduledTaskName='SomeTaskName' # Obtain credentials $username='Domain\Admin' $password='PASSWORD' $encryptedPassword=ConvertTo-SecureString $password -AsPlainText…

Active Directory: Helpdesk Admins Group Creation

Why? Give your helpdesk team the ability to manage user accounts in the domain without…