Public/Get-MaintenanceMode.ps1
Function Get-MaintenanceMode { <# .SYNOPSIS Get MaintenanceMode for Citrix servers .DESCRIPTION Get MaintenanceMode for Citrix servers .PARAMETER MaintenanceMode Provide maintenancemode status .EXAMPLE PS C:\> Get-MaintenanceMode -MaintenanceMode $True .Inputs None .Outputs None .LINK about_functions_advanced .LINK about_CommonParameters #> [CmdletBinding( ConfirmImpact = 'Medium', PositionalBinding = $false, SupportsPaging = $true )] Param ( [Parameter( Mandatory = $true, HelpMessage = 'Provide maintenancemode status (True/False)' )] [ValidateNotNullOrEmpty()] [ValidateSet($true, $false, IgnoreCase = $true)] [Alias('MM')] [bool]$MaintenanceMode ) Try { $Servers = Get-BrokerSharedDesktop -ErrorAction Stop | Where-Object { $_.InMaintenanceMode -eq $MaintenanceMode } | Select-Object DNSName, InMaintenanceMode } Catch { Write-Warning $_.Exception.Message } Finally { $Servers } } |