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

Reset Windows XP Activation

Reboot >> F8 >> Safe Mode >> Logon as Adminitrator >> CMD: rundll32.exe syssetup,SetupOobeBnk >>…

PowerShell RandomPassword Function

function randomPassword{    # return a reasonably randomized password that starts with "KimConnect:" plus 25…

PowerShell: Setting WSUS Registry Setting On/Off for Client Windows

# setWsusOnOff.ps1function setWsus{ param( [switch]$on, [switch]$off ) function wuRegistryIsOn{ # Check if this machine has…
Other project: DragonCoin.com