## Settings you may want to change for your scenario ##
$startTime = Get-Date
$currentTime = $startTime
$elapsedTime = $currentTime - $startTime
$timeOut = 900
try
{
Write-Host "Shutting down distributed cache host."
$hostInfo = Stop-CacheHost -Graceful -CachePort 22233 -ComputerName sp2013App.contoso.com
while($elapsedTime.TotalSeconds -le $timeOut-and $hostInfo.Status -ne 'Down')
{
Write-Host "Host Status : [$($hostInfo.Status)]"
Start-Sleep(5)
$currentTime = Get-Date
$elapsedTime = $currentTime - $startTime
$hostInfo = Get-CacheHost -HostName SP2013app.contoso.com -CachePort 22233
}
Write-Host "Stopping distributed cache host was successful. Updating Service status in SharePoint."
Stop-SPDistributedCacheServiceInstance
Write-Host "To start service, please use Central Administration site."
}
catch [System.Exception]
{
Write-Host "Unable to stop cache host within 15 minutes."
}
Source:Microsoft Technet
It is always advised to stop DC service on SharePoint 2013 before a server is stopped/restarted as per one of the Premium case we worked with Microsoft.
No comments:
Post a Comment