«

»

Jul 10

Reboot Citrix Servers

If you want to reboot Citrix Servers for example every night or week you can do that in Citrix Studio – Delivery Groups – Right Click Delivery Group and select Restart Schedule

Downside with that is that it will only restart computers in maintenance mode.

Here is I PowerShell script that will reboot all servers in the Delivery Group. Save the script and add it in a Task Schedule.

#####################################################

Add-PSSnapin citrix*

 

$servers = get-brokermachine | Where-Object {$_.DesktopGroupName -eq “Name of DeliveryGroup” } | foreach DNSName

### Send a message to users that have an active session ####
$Sessions = Get-BrokerSession -DesktopGroupName “Name of DeliveryGroup” | foreach username

Send-BrokerSessionMessage $Sessions -MessageStyle “Information” -Title “Reboot of Citrix Servers” -Text “Servers will reboot in 10 minutes. Save your data and logoff. In about 20min you can logon again”

Start-Sleep -s 600

foreach ($server in $servers)

{

Restart-Computer -ComputerName $server -Confirm:$false -Force

}

#####################################################

 

 

 

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>