Purpose: The purpose of this article is to display a set of commonly used Citrix Powershell Scripts
Get-Command -PSSnapin Citrix*or
asnp citrix*To get Citrix Director versions
Get-BrokerControllerTo get DB location
Get-LogDatastoreTo get Monitor DB location
Get-MonitorDatastoreTo get Broker DB location
Get-BrokerDbconnectionTo Get Broker DB version
Get-BrokerInstalledDbVersionTest connections
Test-BrokerDBconnection connection strings
Test-ConfigDBConnection connection stringsTo get PVS version
Get-PvsServerTo get PVS server Name
Get-PvsServerNameTo get PVS server Status
Get-PvsServerStatusTo set Citrix License to base
Set-ConfigSite -ProductCode XDT -ProductEdition ADV -LicensingModel UserDevice
Parameters for New-BrokerRebootScheduleV2:
- Name (A friendly name for the new reboot schedule)
- DesktopGroupName (The name of the Delivery Group to which the reboot schedule is being applied)
- RebootDuration (Approximate maximum number of minutes over which the scheduled reboot cycle runs)
- Day (For weekly cycles, the day of the week on which the scheduled reboot cycle starts)
- Description (An optional description for the reboot schedule)
- Enabled (Boolean that indicates if the new reboot schedule is enabled)
- Frequency (Frequency with which this schedule runs – either weekly or daily)
- RestrictToTag (If set, the reboot schedule only applies to machines in the Delivery Group with the specified tag)
- StartTime (Time of day at which the scheduled reboot cycle starts)
- WarningDuration (Time prior to the start of a machine reboot at which a warning message is displayed to all the users on the machine)
- WarningMessage (Warning message displayed in user sessions on a machine scheduled for reboot)
- WarningRepeatInterval (Time to wait after the previous reboot warning before displaying the warning message in all user sessions on that machine again)
- WarningTitle (The window title used when showing the warning message in user sessions on a machine scheduled for reboot)
Here is an example of a command:
New-BrokerRebootScheduleV2 -Name ‘Saturday Reboots for 2012 R2’ -DesktopGroupName ‘Windows Server 2012 R2 Delivery Group’ -Day Saturday -Frequency Weekly -StartTime “2:00” -RebootDuration 120 -RestrictToTag Saturday -WarningDuration 30 -WarningRepeatInterval 10 -WarningMessage “This machine will restart in %m% minutes. Please save your work.” -WarningTitle “Warning: Reboot Pending” -Enabled $true
This command will reboot all machines tagged ‘Saturday’ in the Windows Server 2012 R2 Delivery Group every Saturday between 2-4 am. Thirty minutes prior to the reboot, users will be warned about the pending reboot with a message titled “Warning: Reboot Pending” and stating, “This machine will restart in %m% minutes. Please save your work.”, where %m% will be replaced with the number of minutes remaining until the reboot. This warning will be repeated every 10 minutes until the machines are restarted.
New-BrokerRebootScheduleV2Lists existing reboot schedules
Get-BrokerRebootScheduleV2Update an existing reboot schedule
Set-BrokerRebootScheduleV2Remove a reboot schedule
Remove-BrokerRebootScheduleV2Rename a reboot schedule
Rename-BrokerRebootScheduleV2
Optimizations for Citrix PVS servers
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "IPv4 Checksum Offload" -DisplayValue "Disabled" -NoRestart
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "IPv4 TSO Offload" -DisplayValue "Disabled" -NoRestart
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "Large Send Offload V2 (IPv4)" -DisplayValue "Disabled" -NoRestart
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "Large Send Offload V2 (IPv6)" -DisplayValue "Disabled" -NoRestart
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "Receive Side Scaling" -DisplayValue "Enabled"
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "TCP Checksum Offload (IPv4)" -DisplayValue "Disabled" -NoRestart
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "TCP Checksum Offload (IPv6)" -DisplayValue "Disabled" -NoRestart
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "UDP Checksum Offload (IPv4)" -DisplayValue "Disabled" -NoRestart
Set-NetAdapterAdvancedProperty Ethernet0 -DisplayName "UDP Checksum Offload (IPv6)" -DisplayValue "Disabled" -NoRestart
Disable-NetAdapterBinding -Name "*" -ComponentID ms_tcpip6