Citrix

From Piszczynski
Revision as of 13:18, 22 November 2022 by piszczynski>Aleks (→‎PVS)

Handy Citrix Tips

Stuck session - if session cannot be logged off and does not show on the server you can log off the session in powershell:

  • add-pssnapin *citrix*
  • Get-BrokerSession -username Domain\User | Set-BrokerSession -Hidden $true

Find location of the citrix database used by delivery controllers and netscaler:

  • Get-Brokerdbconnection


Remove citrix licence from account to free up for another user

On the citrix controller:

  • cd "C:\Program Files (x86)\Citrix\Licensing\ls"
  • Udadmin -list -times
  • udadmin -f XDT_ENT_UD -user <username@domain> -delete (example udadmin -f xdt_adv_ud -user <username@domain> -delete)

You might have to repalce the license type with

  • XDT_ADV_UD XenDesktop Advanced
  • XDT_PLT_UD Citrix Virtual Apps and Desktop Premium

Show settings for citrix motoring logging:

  • asnp Citrix.*
  • Get-MonitorConfiguration
  • Set-MonitorConfiguration -<setting name> <value>

Citrix Troubleshooting

If there are no apps available in the storefront check the citrix database for connection - look at the netscaler and see if there are any connection errors showing on console.


For errors when connecting from a new environment check that ports 8080, 1494, 80, 2598, 443 are open between client and all xenapp servers and netscaler.


Unknown machine state:

https://support.citrix.com/article/CTX131267

Citrix RDP to VDA

To RDP to citrix VDA user needs to be admin or member of the remote desktop users group. They will also need to be a member of the Airect Access users which is determined by this registry value: HKLM\Software\Citrix\PortICA\DirectAccessUsers

This will give you an SID, use this to find the group it references in AD

$SID = "<enter SID here>" ; Get-ADObject -Filter * -Properties * | where{$_.objectSid -eq $SID}


Citrix VDA Power State Unknown

Check this article:

http://knowcitrix.com/citrix-vdi-power-state-unknown/

NetScaler

Command Description
show ns ip Shows configured Netscaler IP address (SNIP, VIP, MIP)
show version Shows the current Netscaler firmware version
show hardware Lists hardware details of appliance (including serial number)
sh license Displays licensed feature on appliance
sh running | more Shows the current running configuration (page per time)
sh ns fea Displays list of Netscaler features
en ns fea <acronym> Enables a Netscaler feature (Dependant on license)
dis ns fea <acronym> Disables Netscaler feature
sh ns mode Displays list of configured Netscaler modes
en ns mode <acronym> Enables Netscaler Mode
dis ns mode <acronym> Disables Netscaler mode
sh lb vserver | more Displays list of configured Load Balanced vServers
sh lb vserver <vserver name> Displays information relating to specified vserver
en lb vserver <vserver name> Enable LB vserver
dis lb vserver <vserver name> Disable LB vserver
sh service | more Displays list of configured Services (not service groups)
sh service <service name> Displays information relation to specified service
en service <service name> Enable Service
dis service <service name> <delay> Disable Service with a delay (in seconds)
sh servicegroup | more Displays list of configured Service Groups
sh servicegroup <servicegroup name> Displays information relating to specified servicegroup
en servicegroup <servicegroup name> Enable servicegroup
dis servicegroup <servicegroup name> –delay <#> Disables servicegroup with delay (in seconds)
sh server Displays a list of servers
en server <servername> Enables specified server
dis server <servername> <delay> Disables specified server with a delay (in seconds)
sh monitor Shows the list of configured Netscaler monitors
sh monitor <monitor name> Displays information relating to the specificed monitor
sh route Prints a list of defined routes
add route <network> <netmask> <gateway> Adds a static route on the appliance
rm route <network> <netmask> <gateway> Removes a static route on the appliance
sh int Displays information on all network interfaces
sh int <interface number> Displays information relating to specified network interface
en int <interface number> Enable Netscaler NIC
dis int <interface number> Disable Netscaler NIC
sh arp Displays information from ARP table (including iface used)
sh vlan Displays VLAN ID’s and assigned NIC’s
sh ha node Displays HA node status
force ha fail Forces HA Failover between nodes
nstrace –tcpdump enable Performs a packet capture (all NICs) with tcpdump enabled
shell Exits to shell command prompt (FreeBSD)
dmesg Displays system message log from shell (since reboot)
save c Saves current running config to file 

Duplicate entries in citrix controller

Method to delete Stale entries from citrix database

Step 1) To find the machine ID in Citrix Monitoring DB

Select ID,Name,IPAddress,HostingServerName,CurrentRegistrationState From [MonitorData].[Machine] where Name Like'%VDA03%'

Select ID,Name,IPAddress,HostingServerName,CurrentRegistrationState From [MonitorData].[Machine] where Name Like'%VDA06%'

Select ID,Name,IPAddress,HostingServerName,CurrentRegistrationState From [MonitorData].[Machine] where Name Like'%VDA09%'

step 2  : To compare the Machine ID in Session Table

select * from [MonitorData].[Session] where  MachineId = '1E22A7A8-AD67-46B9-AB87-EACE0DF22AE3'   ---  VDA03 

select * from [MonitorData].[Session] where MachineId = 'FCC1D88F-D553-4C96-AA92-5D3A7435D846' --- VDA06

select * from [MonitorData].[Session] where MachineId = '71889325-37B1-4929-B527-D81BA04ABC6D' ----VDA09


Step 3 : Then replaced ID of stale Machine Id with the correct Machine Id in the Session Table

----- VDA03

UPDATE [MonitorData].[Session] SET MachineId='DB76C220-48BE-4297-95BA-D105109E735A' WHERE MachineId='1E22A7A8-AD67-46B9-AB87-EACE0DF22AE3'

----- VDA06

UPDATE [MonitorData].[Session] SET MachineId='1AD3F50D-97E2-4660-8656-1523AED50D83' WHERE MachineId='FCC1D88F-D553-4C96-AA92-5D3A7435D846'

----- VDA09

UPDATE [MonitorData].[Session] SET MachineId='207FC7C2-FF72-4DEA-8F30-A5B3FD8CC410' WHERE MachineId='71889325-37B1-4929-B527-D81BA04ABC6D'


Step 4 : Removed the Old Stale Machine as per the following

DELETE FROM [MonitorData].[Machine] WHERE ID = ‘1E22A7A8-AD67-46B9-AB87-EACE0DF22AE3’

DELETE FROM [MonitorData].[Machine] WHERE ID = ‘FCC1D88F-D553-4C96-AA92-5D3A7435D846'

DELETE FROM [MonitorData].[Machine] WHERE ID = ‘71889325-37B1-4929-B527-D81BA04ABC6D'

Clear and recreate database

Completethe following to repair the citrix local host database.

Carry this out on the server containing the citrix database

1. Download PsExec Sysinternal tool on the Delivery Controller, copy to C:\Temp

a. PsExec: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec

2. Stop Citrix High Availability Service

3. Open the command prompt, navigate to C:\Temp, execute the below command to elevate the command prompt with Network Service account

a. PsExec -i -u "NT AUTHORITY\NETWORK SERVICE" cmd

4. Run the command whoami to confirm the account.

5. Navigate to the SqlLocalDB installed path

a. For SQL LocalDB 2014: cd "C:\Program Files\Microsoft SQL Server\120\Tools\Binn"

For SQL LocalDB 2017: cd "C:\Program Files\Microsoft SQL Server\140\Tools\Binn"

6. Execute the below two commands to Stop and delete CitrixHA (LocalDB) database.

a. SqlLocalDB stop CitrixHA

b. SqlLocalDB delete CitrixHA

7. Remove the below files located in C:\Windows\ServiceProfiles\NetworkService

a. HADatabaseName.*

b. HADatabaseName_log.*

c. HAImportDatabaseName.* (If exists)

d. HAImportDatabaseName_log.* (If exists)

8. Start Citrix High Availability Service

9. Execute the below command to confirm that CitrixHA is recreated

a. SqlLocalDB i

CitrixHA <<<< disappears just after Stop/delete in step 5, and appears after start Citrix High Availability Service in step 7 MSSQLLocalDB


PVS

issue with PVS server unable to load Citrix.PVS.Snapin could be caused by recent upgrade of PVS/citrix or applayering. You will need to redeploy and reregister the plugin. Use the following commands:

  • CD \Windows\Microsoft.NET\Framework64\v4.0.30319
    • .\InstallUtil.exe "C:\Program Files\Citrix\Provisioning Services Console\Citrix.PVS.Snapin.dll"
  • CD \Windows\Microsoft.NET\Framework\v4.0.30319
    • .\InstallUtil.exe "C:\Program Files\Citrix\Provisioning Services Console\Citrix.PVS.Snapin.dll"

PVS replication of images is done through RoboCopy.

See .bat settings:

  • Robocopy <Location of new + current builds> <Network location of other PVS builds in cluster> *.vhdx *.vhd *.avhd *.avhdx *.pvp /b /mir /r:5 /w:5 /xf *.lok /xd WriteCache /xo

Issue with PVS citrix xenapp servers with performance and possible crashing of environment:

Issue could be due to write cache disk not being online during boot of citrix server causing write cache to default to the PVS server.

Solution is to set disk management to online all disks on boot in PVS image:

  • diskpart
  • sanpolicy=onlineall
  • exit

If disk still shows offline due to policy set by administrator then the following attribute will need to be set on the disk:

  • diskpart select disk <disknumber>
  • attributes disk (check to see if its read only)
  • attributes disk clear readonly

May also need to assign the same unique ID to the disk as the gold image:

Find unique id in diskpart:

  • Uniqueid disk

Change unique disk id to match

  • Unique disk id=<diskid>

Citrix profile management - troubleshooting

When seeing issues with citrix UPM profiles use the config checker to identify any potential issues:

https://support.citrix.com/article/CTX132805?_ga=1.60278061.1208613434.1464163161

Citrix profile Management - Exclusions and Inclusions

When using citrix UPM ensure the recommended folders are excluded/included:

https://support.citrix.com/article/CTX230538?

Information
Exclusion list-directories [These are part of Default Exclusions from UPM 5.3 onwards]

!ctx_internetcache!

AppData\Local\Google\Chrome\User Data\Default\Cache

AppData\Local\Google\Chrome\User Data\Default\Cached Theme Images

AppData\Local\Google\Chrome\User Data\Default\JumpListIcons

AppData\Local\Google\Chrome\User Data\Default\JumpListIconsOld

AppData\Local\GroupPolicy

AppData\Local\Microsoft\AppV

AppData\Local\Microsoft\Messenger

AppData\Local\Microsoft\Office\15.0\Lync\Tracing

AppData\Local\Microsoft\OneNote

AppData\Local\Microsoft\Terminal Server Client

AppData\Local\Microsoft\UEV

AppData\Local\Microsoft\Windows Live

AppData\Local\Microsoft\Windows Live Contacts

AppData\Local\Microsoft\Windows\Application Shortcuts

AppData\Local\Microsoft\Windows\Burn

AppData\Local\Microsoft\Windows\CD Burning

AppData\Local\Microsoft\Windows\Notifications

AppData\Local\Packages

AppData\Local\Sun

AppData\Local\Windows Live

!ctx_localsettings!\Temp

AppData\Roaming\Microsoft\AppV\Client\Catalog

AppData\Roaming\Sun\Java\Deployment\cache

AppData\Roaming\Sun\Java\Deployment\log

AppData\Roaming\Sun\Java\Deployment\tmp

$Recycle.Bin

AppData\LocalLow

Tracing

 

new path for Temporary Internet Files in Windows 8 and later

AppData\Local\Microsoft\Windows\INetCache                                        

 

If running Office 365 with Shared Computer Activation, then exclude

!ctx_localappdata!\Microsoft\Office\15.0\Licensing

!ctx_localappdata!\Microsoft\Office\16.0\Licensing

 

Exclusion List-Files

!ctx_localappdata!\Microsoft\Windows\UsrClass.dat*

 

 Directories to synchronize.

AppData\Local\Microsoft\Credentials

Appdata\Roaming\Microsoft\Credentials

Appdata\Roaming\Microsoft\Crypto

Appdata\Roaming\Microsoft\Protect

Appdata\Roaming\Microsoft\SystemCertificates

 

 

Files to Synchronize

AppData\LocalLow\Sun\Java\Deployment\security\exception.sites

AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs

AppData\LocalLow\Sun\Java\Deployment\deployment.properties

AppData\Local\Google\Chrome\User Data\First Run

AppData\Local\Google\Chrome\User Data\Local State

AppData\Local\Google\Chrome\User Data\Default\Bookmarks

AppData\Local\Google\Chrome\User Data\Default\Favicons

AppData\Local\Google\Chrome\User Data\Default\History

AppData\Local\Google\Chrome\User Data\Default\Preferences