如何使用命令关闭Citrix XenDesktop?
Hey there, let's walk through how to shut down your Citrix XenDesktop environment using command-line tools—this is something I’ve helped teams with countless times, so let’s break it down clearly.
First, note that you’ll need administrative privileges (both for Windows and Citrix) and should run these commands from a Delivery Controller or a machine with the Citrix XenDesktop PowerShell modules installed.
Step 1: Load Citrix PowerShell Modules
Start by opening PowerShell as Administrator and loading the required Citrix snap-ins:
Add-PSSnapin Citrix*
Shut Down All VDA Machines
Before shutting down your controllers, it’s best to power off all Virtual Delivery Agents (VDAs) first to avoid disrupting user sessions. Here’s how to send a shutdown command to all registered VDAs:
# Retrieve all VDA machines and send shutdown command Get-BrokerMachine | Send-BrokerMachineCommand -Command Shutdown
If you only need to shut down a specific VDA, target it by machine name:
# Shut down a single VDA Get-BrokerMachine -MachineName "YourVDAMachineName" | Send-BrokerMachineCommand -Command Shutdown
Pro tip: Always check for active user sessions before shutting down VDAs. You can list sessions with Get-BrokerSession and log users off safely using Invoke-BrokerSessionLogoff -SessionId [SessionID] if needed.
Shut Down Delivery Controller Services
Once VDAs are off, you can stop the core Citrix services on your Delivery Controllers to fully shut down the XenDesktop infrastructure:
# Stop key Citrix XenDesktop services Stop-Service -Name "BrokerService","CitrixMachineCreationService","CitrixHostingUnitService","CitrixLicensingService","CitrixConfigurationLoggingService" -Force
If you want to shut down the Controller machine itself after stopping services, add this command:
# Shutdown the Delivery Controller machine Stop-Computer -Force
Full Environment Shutdown Order
For a complete clean shutdown, follow this sequence:
- Log off all active user sessions (via
Invoke-BrokerSessionLogoff) - Shut down all VDA machines
- Stop Citrix services on Delivery Controllers
- Shut down Delivery Controller machines
- Shut down supporting components (like License Servers, StoreFront servers)
内容的提问来源于stack exchange,提问作者Kumar Sambhav Pandey

