knowledge base


PowerShell with Citrix


Set Pssword renew

http://blog.citrix24.com/xendesktop-7-6-install-with-powershell-cheat-sheet/ #List all sessions with status different than Listening or Connected Get-XASession |Select SessionId, AccountName, ServerName, State |Where {$_.State -ne "Listening" -and $_.State -ne "Connected"} #List all session with status Active or Disconnected Get-XASession |Select SessionId, AccountName, ServerName, State |Where {$_.State -eq "Active" -or $_.State -eq "Disconnected"} #List all counter sets get-counter -listset * get-counter -listset "citrix*" #Available Citrix counter sets: Citrix Licensing Citrix CPU Utilization Mgmt User Citrix IMA Networking Citrix MetaFrame Presentation Server ICA Session #List all counter names in the ICA Session counter set (get-counter -listset "ica session").counter #List all counter names matching specified criteria (get-counter -listset "ica session").counter |where {$_ -match "latency" } #Display counter value for ICA session average latency Get-Counter -Counter "\ICA Session(*)\Latency - Session Average" or $1=(get-counter -listset "ica session").counter |where {$_ -match "session average" } Get-Counter -Counter $1 #Reset session Stop-XASession -ServerName Server01 -SessionId 2 or Get-XASession |where {$_.accountname -like "*UserABC"} |Stop-XASession #Disconnect session Disconnect-XASession -ServerName Server01 -SessionId 3 or Get-XASession |where {$_.accountname -like "*UserABC"} |Disconnect-XASession #List all processes in particular session Get-XASessionProcess -ServerName Server01 -SessionId 2 |select ProcessName, ProcessId #Stop application running process 5304 Stop-XASessionProcess -ServerName xenufrdtc01 -ProcessId 5304 # Get-XAWorkerGroup *EMEA* |Select WorkerGroupName |Get-XAApplication |Select DisplayName,ClientFolder,ApplicationType |Out-File -Append c:\app-group.txt # Get-XAApplicationReport -BrowserName ApplicationABC |select Accounts # Get-XASession |Select SessionId, State, BrowserName, AccountName, ServerName |Where {$_.AccountName -like "*UserABC*"} #List all processes in particular session Get-XASessionProcess -ServerName Server01 -SessionId 2 |select ProcessName, ProcessId #Stop application running process 5304 Stop-XASessionProcess -ServerName xenufrdtc01 -ProcessId 5304 #List all drivers from Server01 Get-XAPrinterDriver -SourceServerName Server01 |Select DriverName |Sort DriverName #List all drivers matching name HP* Get-XAPrinterDriver -ServerName Server01 |Select DriverName |Where {$_.DriverName -like "HP*"} |Sort DriverName Get-XAPrinterDriver -ServerName Server01 |Select DriverName |Where {$_.DriverName -like "HP*v6*"} |Sort DriverName #List printer drivers in the Auto-Replication-List Get-XAAutoReplicatedPrinterDriver #Manual replication Start-XAPrinterDriverReplication "HP Universal Printing PCL 6 (v6.0.0)" -ServerName Server02,Server03 #Auto replication Add-XAAutoReplicatedPrinterDriver -ServerName Server01 "HP Universal Printing PCL 6 (v6.0.0)" ---------------------------------------------------------------------------------------------------- https://www.peppercrew.nl/index.php/2015/03/where-did-qfarm-go-in-xenapp-7-5-7-6/ https://lalmohan.co.nz/2015/10/19/running-a-qfarm-command-in-xenapp-7-x/ Get-BrokerMachine -SessionSupport MultiSession -Property 'DnsName','LoadIndex','SessionCount' The PowerShell command is a quite long, to make it easy for ourselves we can create an alias. Add-PSSnapin citrix.* set-alias qfarm Qfarm-Load function Qfarm-Load {Get-BrokerMachine -SessionSupport MultiSession -Property dnsName,loadIndex,SessionCount} Qfarm-Load If you want to do an “Qfarm output” export to a textfile: Qfarm-load | format-table -auto | Out-File -Encoding ASCII \\“servername”\c$\Temp\Farmload.txt -Width 150 ----------------------------------------------------------------------------------------------------- Logon mode for RDP is per-server configuration that is stored in registry. Configuration of logon mode is stored in registry in two different locations: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\TSServerDrainMode 0 = Allow all connections 1 = Allow reconnections, but prevent new logon until reboot 2 = Allow reconnections, but prevent new logon HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\WinStationsDisabled 0 = Enabled 1 = Disabled When server is in drain mode, WinStationDisabled is always 0 (enabled). ------------------------------------------------------------------------------------------------------ https://docs.citrix.com/de-de/xenapp-and-xendesktop/7-6/cds-sdk-wrapper-rho/xad-commands.html https://docs.citrix.com/de-de/xenapp-and-xendesktop/7-6/cds-sdk-wrapper-rho/xad-commands/citrix-broker-admin-v2-wrapper-xd76/get-brokercontroller-xd76.html