Citrix XenApp

Your Journey towards cloud.

Virtualization Picking up Speed

Are your Skills keeping up? Skill up. Be Relevant

Are you a System Admin

Learn Citrix XenApp, Its future.

Citrix XenApp

Industry-leading virtualization platform for building cloud.

Cloud Computing in Demand

Learn how to build cloud on Citrix XenApp.

Monday, 5 March 2012

Local Host Cache in Citrix

A subset of data store information, the local host cache, exists on each server in the farm, providing each member server with quick access to data store information. The local host cache also provides redundancy of the data store information, if for example, a server in the farm loses connectivity to the data store.

When a change is made to the farm’s data store, a notification to update the local host cache is sent to all the servers in the farm. However, it is possible that some servers will miss an update because of network problems. Member servers periodically query the data store to determine if changes were made since the server’s local host cache was last updated. If changes were made, the server requests the changed information.
Refreshing the Local Host Cache

You can force a manual refresh of a server’s local host cache by executing dsmaint refreshlhcfrom a command prompt. This action forces the local host cache to read all changes immediately from the farm’s data store. Refreshing the local host cache is useful, for example, if the Citrix Independent Management Architecture (IMA) Service is running, but published applications do not appear correctly when users browse for application sets.

A discrepancy in the local host cache occurs only if the IMA Service on a server misses a change event and is not synchronized correctly with the data store.

Recreating the Local Host Cache

You can manually create the local host cache from the farm’s data store. If the IMA Service fails to start or you have a corrupt local host cache, you may need to recreate it.

To recreate the local host cache, stop the IMA Service and then run the command dsmaint recreatelhc. Running this command performs three actions:
  • Sets the value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\IMA\ RUNTIME\PSRequired to 1.
  • Deletes the existing local host cache (Imalhc.mdb)
  • Creates an empty local host cache (Imalhc.mdb).
You must restart the IMA Service after running dsmaint recreatelhc. When the IMA Service starts, the local host cache is populated with fresh data from the data store.

The data store server must be available for dsmaint recreatelhc

Tuning Local Host Cache Synchronization

to work. If the data store is not available, the IMA Service fails to start.
You can adjust the interval by which member servers query the farm's data store for missed changes. The default interval is 30 minutes. In most cases, this default setting is sufficient.
 
Caution: Editing the Registry incorrectly can cause serious problems that may require you to reinstall your operating system. Citrix cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. Be sure to back up the registry before you edit it.
You can configure the interval by creating the following registry key on each server you want to adjust, with the value expressed in hexadecimal notation:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\IMA\ DCNChangePollingInterval (DWORD)
Value: 0x1B7740 (default 1,800,000 milliseconds)

You must restart the IMA Service for this setting to take effect.

Most changes made through the Citrix AppCenter are written to the data store. When you open one of these tools, it connects to a specified server. The Citrix Independent Management Architecture (IMA) Service running on this server performs all reads and write operations to the data store for the AppCenter.
If the data store is experiencing high CPU usage when few read or write operations to the data store are occurring, it is possible that the data store is not powerful enough to manage a query interval of 30 minutes. To determine whether or not the data store query interval is causing the high CPU usage on the data store, you can set the query interval to a very large number and test CPU usage. If the CPU usage returns to normal after you set a large query interval, the data store query interval is probably the cause of the high CPU usage. You can adjust the query interval based on performance testing.

To test the query interval, set the interval to 60 minutes and then restart all the servers in the farm. If the data store is still experiencing constant high CPU usage, increase the query interval further. If the CPU usage returns to normal, you can try a smaller value. Continue these adjustments until data store CPU usage is normal.
 
Important: Do not set the data store query interval higher than necessary. This interval serves as an important safeguard against lost updates. Setting the interval higher than necessary can cause delays in updating the local host cache of the farm’s member servers.

Safely Remove USB Drives Automatically

All the computer users are nowadays been got quite used to unplug a USB flash drive only after selecting the “Safely Remove USB Drives” option in the System Tray in the Taskbar. Anyone doesn’t wants to skip this step thinking that their USB Drive will get defected.
What’s the reason for this? According to me, it’s only need is to check whether any action such as copying data from or to the drive is going on when it is to be removed as any interruption in the process can lead to corrupted data or dead USB Drive.
But as I am here to tell you about the trick to Safely Remove USB Drives Automatically, so just see how you can safely avoid this step keeping your USB Drive completely safe. In fact, you may already have had this option enabled on your computer but you might not be aware of it and would have been wasting some of your valuable time in those extra clicks.

Steps To Safely Remove USB Drives Automatically

(Note: These steps may differ on different versions of Windows.)
1. The first task is to plug in the USB Drive to your PC. Then, Open Device Manager using the run command “devmgmt.msc”.
2. Expand Disk Drives option, then click on the removable device you have inserted by locating it. Here in the screenshot, it’s “USB2.0 Flash Disk USB Device.”
3. Right-click that device, then click Properties.
4. Click the Policies tab; you should see something like this:

5. Select the first option, i.e. Quick Removal. If the option is already selected then its well and good. As given in the description above, “you can disconnect the device safely without using the Safely Remove Hardware notification icon.”
Don’t take tension that the performance will suffer as results have proved that there’s gonna be no change in the performance. There will surely be a change but that will be in milliseconds that can surely not matter compared to the hassle of selecting Safely Remove USB Drive option each time you connect your USB Drive to the computer. So, just go ahead to Safely Remove USB Drives Automatically and make this change in every computer you tend to use and have fun.

Sunday, 4 March 2012

Script to find all the disconnected sessions in citrix servers

I know the effort in logging into all the citrix servers for disconnected sessions and logging them off everyday. So I have designed a batch script which would run the qfarm command in all the servers mentioned in the text file and output the result to a text file. Here goes my script:

@echo off
Title Developped by Chaitanyakumar G
cd \
cd %userprofile%\Desktop\Servers
del /q *
cd \
cd %userprofile%\Desktop\Apps
for /f %%i in (hostnames.txt) do psexec.exe \\%%i -u Domain\username -p UR_PWD cmd /c "qfarm %%i /disc" >> .\Servers\%%i_Applications.txt
pause

In ur desktop, create a folder called Servers where all your servers text files would be created. Create an other folder called Apps where you need to have psexec.exe(you can download it from here). Here you need to create a text file hostnames.txt and place all your citrix servers, no matter which farm they belong to. As this script takes the hostnames from the text file hostnames.txt, we can place all the citrix servers here. Now copy the above script and place it in Apps folder. Now double click it. Once the script is executed, in the Servers folder we can see list of files. We can see all the files here. View by details in the folder view to find the size of the text files. If size of text file is zero, it shows that there are no disconnected sessions for that particular server. If size is more than zero, it shows that there are disconnected sessions. Now login to that particular server and clear the disconnected sessions. In the text file you can also see the application name. So, you can directly open that particular application and disconnect the sessions. This script will be useful if you have lot of citrix applications and servers.

If you still want to reduce the administrator effort, execute the script and once you get the text files in Servers folder, download tslogoff.exe(download it from here). Go through the Readme.txt file about the usage and logoff the disconnected sessions by connecting to the server using psexec.exe

What is hiberfil.sys and How Do I Delete It?

You’re no doubt reading this article because there’s a gigantic hiberfil.sys file sitting in the root of your drive, and you want to get rid of it to free up some space… but you can’t!
Luckily, you actually can delete it, and today we’ll show you how.
image
The more memory you have in your PC, the bigger the file will be.
So What is hiberfil.sys Anyway?
Windows has two power management modes that you can choose from: one is Sleep Mode, which keeps the PC running in a low power state so you can almost instantly get back to what you were working on. The other is Hibernate mode, which completely writes the memory out to the hard drive, and then powers the PC down entirely, so you can even take the battery out, put it back in, start back up, and be right back where you were.
Hibernate mode uses the hiberfil.sys file to store the the current state (memory) of the PC, and since it’s managed by Windows, you can’t delete the file.
So if you never use it, and want to disable Hibernate mode, keep reading. Personally I stick with Sleep Mode the vast majority of the time, but I do use Hibernate quite often.
Disable Hibernate (and Delete hiberfil.sys) in Windows 7 or Vista
You’ll need to open an administrator mode command prompt by right-clicking on the command prompt in the start menu, and then choosing Run as Administrator. Once you’re there, type in the following command:
powercfg -h off
You should immediately notice that the Hibernate option is gone from the Shut down menu.
You’ll also notice that the file is magically gone!

Disabling Hibernate Mode in Windows XP
It’s a lot easier in Windows XP to get rid of Hibernate mode…. Just head into Control Panel –> Power Options, and then find the Hibernate tab.
Uncheck the box, reboot your PC, and then you can delete the hiberfil.sys file.

Saturday, 3 March 2012

Defrag Multiple Hard Drives At Once In Windows

The Disk Defragment utility in Windows XP does not include a way to defragment all hard drives at the same time, which is inconvienient when you have more than one hard drive in your computer.
The method we are going to use is by creating a batch file to defragment all of the drives, one after the other.
The disk defrag utility in Windows XP can be triggered from the command line with the following syntax:
Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.
Usage:
defrag <volume> [-a] [-f] [-v] [-?]
volume drive letter or mount point (d: or d:\vol\mountpoint)
-a Analyze only
-f Force defragmentation even if free space is low
-v Verbose output
-? Display this help text
First, we’ll create a file named defragall.bat, and place it anywhere you like, as long as you’ll remember where it is. If you want to run it from the command line, you could place it in the \windows directory so that it will be available in the system path.
For each hard drive, add a line to the batch file. For instance, if we want to defragment drives C: , D: , and F: we will add these three lines:
defrag c: -f
defrag d: -f
defrag f: -f

To run the defrag, just either double-click on the batch file or start it from the command line.

Thursday, 1 March 2012

Auto Deletion of Temporary Folder

You can set the computer to delete automatically your files in temporary folder. 
To do that click Run from start menu and type gpedit.msc 
and click OK. 
And select Computer Configuration/Administrative Templates/Windows Components/Terminal Services/Temporary Folder.
Then right click "Do Not Delete Temp Folder Upon Exit
Go to properties and select disable

Allow Remote Control To Your Desktop On Ubuntu

Enabling remote desktop mode is extremely easy on Ubuntu since Dapper. You can allow other users to access your desktop using the VNC Viewer utility that is bundled with Ubuntu, or offered as a free download for Windows.
Note that enabling remote control of your desktop is never a safe thing to do unless you have a firewall installed and configured correctly, and even then is still a potential security problem. Now that you’ve been warned of the risks, let’s move on.
Navigate to the System \ Preferences \ Remote Desktop on the Gnome top menu.
You’ll see this window:
The first two checkboxes need to be checked in order for remote desktop to be enabled.
The Security section is important: If you select the “Ask you for confirmation” code, then you will need to be at the computer in order to allow the other person to access your desktop. If you are trying to remotely access one of your own computers, you will want to uncheck this box.
The second checkbox should always be checked, and you should enter a secure password. You will be prompted for this password when you try to log on.

Tested on: Ubuntu Dapper Drake, Ubuntu Edgy Eft