Tuesday, June 28, 2011

Only administrators have permission to add, remove or configure server software during a Terminal services remote session.

When you are installing software on a Terminal Server, getting the following error though you have proper Administrative rights on that Terminal Server. You are unable to proceed with installation.

"Only administrators have permission to add, remove or configure server software during a Terminal services remote session. If you want to install or configure software on the server, contact your local Administrator."










Resolution
Add the following registry entry on the server:

HKEY_LOCAL_MACHINE \Software \Policies \Microsoft \Windows \Installer

Value name: EnableAdminTSRemote

Date Type: REG_DWORD

Value data: 1

Base: Hexadecimal

Sunday, June 26, 2011

PowerShell: Retrieving Citrix server names that are having a paricular software installed

I want to list the Citrix server names on which Acrobat Reader X installed. Following PowerShell script is helpful for that. This script will store the server list in a log file as well as display the server list in the console.

cls
Add-PSSnapin Citrix.XenApp.Commands


##########################################
# Declaring a log file to store the result
##########################################

$log_file = 'C:\InstalledServers.txt'
Clear-Content $log_file


#########################
# Getting list of Citrix servers
#########################
$servers = Get-XAServer

#######################
# Storing result in the log fle
#######################

ECHO "List of Servers having Adobe Reader X installed" >> $log_file
ECHO "************************************************" >> $log_file



Write-Host "List of Servers having Adobe Reader X installed"
foreach($server in $servers)
{
 $colItems = get-wmiobject -class "Win32_Product" -namespace "root\CIMV2" -ComputerName $server | where-object { $_.Caption -eq 'Adobe Reader X' }
 

$colItems.__SERVER >> $log_file
 write-host $colItems.__SERVER
}

PowerShell: Getting list of installed softwares from remote computer

Following PowerShell script can be used to retrieve list installed softwares from a remote server.

cls
$strComputer = "<put server name here>"

$AllItems = get-wmiobject -class "Win32_Product" -namespace "root\CIMV2" -computername $strComputer

foreach ($objItem in $AllItems)
{
    write-host "Caption: " $objItem.Caption
    write-host "Description: " $objItem.Description
    write-host "Identifying Number: " $objItem.IdentifyingNumber
    write-host "Installation Date: " $objItem.InstallDate
    write-host "Installation Date 2: " $objItem.InstallDate2
    write-host "Installation Location: " $objItem.InstallLocation
    write-host "Installation State: " $objItem.InstallState
    write-host "Name: " $objItem.Name
    write-host "Package Cache: " $objItem.PackageCache
    write-host "SKU Number: " $objItem.SKUNumber
    write-host "Vendor: " $objItem.Vendor
    write-host "Version: " $objItem.Version
    write-host
}

Citrix: Deploying Acrobat Reader X (Version 10) using Citrix Installation Manager

Using Installation Manager you can deploy Acrobat Reader X to all of your Citrix servers using the following procedures.
  1. Dowonlaod full standalole package of Acrobat Reader X (Version 10) from HERE.
     
  2. Download Adobe Customization Wizard X from HERE.
  3. Install Adobe Customization Wizard X on the server - accecpt all defaults.
     
  4. Extract the Acrobat Reader X exe using the following command:

    AdbeRdr1000_en_US -nos_ne


     
  5. Wait for the window that pops up to do its work.
     
  6. Once extraction is complete, go to the following path to check the extracted folder. You will get the folder Adobe. The Acroread.msi file can be found inside that folder.

    C:\Documents and Settings\All Users\Application Data




     
  7. Now open Adobe Customization Wizard X.
     
  8. Click on File --> Open and open the AcroRead.msi file.
     
  9. Go to EULA and click on Suppress Display of End User License Agreement (EULA).


     
  10. Click on Online and Acrobat.com Features and select Disable all updates and Disable all Acrobat.com access, including initiation and participation check boxes.


     
  11. Save the package from File --> Save Package.


     
  12. It will create two extra files in the same folder of AcroRead.msi. These two files are:

    AcroRead.mst
    AcroRead.ref


     
  13. Copy all the files inside that folder. Create a shared folder and paste there.




     
  14. Now open Citrix XenApp Advanced Configuration. Go to Installation Manager --> Packages. Right click on it and select Add Package.


     
  15. Select AcroRead.msi from the shared path by clicking on the Browse button and then enter the Package Name. click OK.


     
  16. Click No.


     
  17. Click OK on the confirmation message.
     
  18. Right click on the package name you have created and then click on Install Package.


     
  19. Add the server(s) on which you want to deploy that package and then click on Next.
     
  20. Click Finish to deploy the package immediately.


     
  21. On successful deployment you will get the status as Success in the Citrix Access Management Console.

Saturday, June 25, 2011

The Terminal Server has exceeded the maximum number of allowed connections

Problem

If  users simply close the remote desktop window; their sessions remain disconnected and if TS Session is not configured to end the disconnected session after a certain time limit, further user login to that terminal serer won't be possible due to the following error:









Resolution
  1. Open Command Prompt and execute the following command:

    query session server:<server name>(OR)
    query session server:<IP address>

    Replace the <server name> or <IP address> with the remote machine host name or IP address.

    For example, query session server:TS-1[Note: Here TS-1 is the Terminal Server host name I am using.]


     
  2. This will show the details of the connected or disconnected users. Note down the ID and corresponding username you want to reset.

  3. To reset a particular ID execute the following command:

    reset session <ID> /server:<server name>

    For example, reset session 2 /server:TS-1
     
    [Note:
    You can also use a nice GUI tool to query and reset the remote sessions. Please click HERE to download the tool named Remote TS Manager from JR Software]



    Here I have resetted all the users sessions existing on the TS-1 server.
     
  4. To check the session status execute the command mentioned in Step:1.

    query session server:<server name>(OR)
    query session server:<IP address>


     
  5. Now if you try to RDP to that server, you will be able to do that.
     
  6. Once you logged in to the server, go to Start --> Programs --> Administrative Tools --> Terminal Services Configuration.
     
  7. Right click on RDP-Tcp --> Propreties.


     
  8. Enable Override User Settings check box and enter the time in End a disconnected session. This will prevent to occur this type of problem going forward.

Alternative method to reset user session (GUI Based)
  1. Login to any other server.
     
  2. Go to Start --> Administrative Tools --> Terminal Services Manager

     
  3. Click on Actions --> Connect to Computer...--> enter the server name where you want to connect --> click OK
     
  4. Now you will get all sessions of that server. Right click on the desired user and choose Log Off.

Sunday, June 19, 2011

Citrix: Datastore Backup and Restore (MS Access and MSDE)

Following is a great batch script that you can schedule to take backup of Datastore if you are using MS Access or MSDE as database.

It will backup C:\Program Files\Citrix\Independent Management Architectures and store it to C:\Backup_Datastore
It overwrites the previous backed up data.

To run the script copy the entire script and save it as .bat extension.


@echo off
REM ======================================================================
REM NAME : Citrix Backup
REM AUTHOR : Russell Pitcher, SAVVIS Inc
REM DATE : 13/02/2009
REM COMMENT: Backup of CTX Datastore - requires windows 2003 and sleep.exe
REM ======================================================================


set MESSAGE=The Citrix MetaFrame farm is going down for periodic maintenance. Please save your files, log out, and reconnect in one hour to continue working.
set IMAFOLDER=%PROGRAMFILES%\Citrix\Independent Management Architecture
set BACKUPFOLDER=C:\Backup_Datastore


echo Message = %MESSAGE%
echo IMA folder = %IMAFOLDER%
echo Backup folder = %BACKUPFOLDER%


REM goto :END


REM Warn users to log out and stop new logons
msg * %MESSAGE%
change logon /disable


echo.
echo Pausing for 30 seconds...
sleep 30


echo.
echo Stopping Citrix services
net stop ctxHttp
net stop MFCom
net stop "Citrix SMA Service"
net stop CitrixWMIService
net stop IMAService /y
echo.
echo Stopped Citrix services


echo.
echo Recreating Citrix LHC
"%PROGRAMFILES%\Citrix\system32\Citrix\IMA\DsMaint.exe" RecreateLhc


echo.
echo Pausing for 30 seconds...
sleep 30


REM Clear the backup folder, or create it if it does not exist
if exist "%BACKUPFOLDER%" (
echo.
echo Clearing backup folder
del "%BACKUPFOLDER%\*.*" /f /q
) else (
echo.
echo Backup folder missing. Logging event and recreating folder
md "%BACKUPFOLDER%"
EventCreate /l application /t warning /so SAVVIS /id 999 /d "The %BACKUPFOLDER% folder was missing. It has been recreated, but the security has been reset to 'Allow inheritable permissions'. Please verify the security settings."
)


echo.
echo Backing up the Citrix datastore
copy "%IMAFOLDER%\*.*" "%BACKUPFOLDER%"


echo.
echo Re-starting Citrix services
net start "Citrix SMA Service"
net start CitrixWMIService
net start IMAService
net start MFCom
net start ctxHttp


echo.
echo Re-enable new logons
change logon /enable


:END
echo.
echo == The End ==
echo.

Saturday, June 18, 2011

Citrix: Datastore Backup and Restore (SQL 2005)

Here is the step-by-step procedure about how to backup Citrix database on SQL 2005 server.

Note: Do not use DSMAINT BACKUP builtin Citrix command. This command is only used if you want to take backup of MS Access or MSDE database.

Backup up database

Steps
  1. Log into the database server and open Microsoft SQL Server Management Studio.
  2. Navigate to the Citrix/XenApp database. Here I am using the database named "XenApp".
  3. Right Click on the database --> Tasks --> Back Up

     
  4. Select the backup type. The default is Full. I prefer to use Full database backup as the database size is very small.
     
  5. Click on Option. Keep the default options. To schedule the backup job click on Script and then select Script action to job.



     
  6. Go to Schedule and click on New to create a backup schedule.



      
  7. Click OK thrice to start and schedule the backup process. Once database backed-up successfully, you will get the following notification.

     
  8. The default backup location is C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\
Restoration
The backedup database can be restore any time if you feel datastore has been corrputed. To do so perform the following steps.
  1. To restore, Right Click on Database and then select Restore Database.

     
  2. Select the To Database and From Database from the drop-down list. Here I have selected XenApp as this is the database I want to restore.
     
  3. Go to Option and select Overwrite the existing database. Click OK to start the restoration procedure.

     
  4. After restoration is successfully completed, you will get the following message. Click OK to close the message.

WMIC command is giving Error Code = 0x80041010

I am trying to run the following command that will check the version of the specific installed application, but I am getting the following error:

wmic product where "Name like '%citrix online%'" get Name, Version

Error
Node - <server name>
ERROR:
Code = 0x80041010
Description = Invalid class
Facility = WMI






Resolution

Install WMI Windows Installer Provider component to resolve this issue.

Go to Add or Remove Programs --> Add/Remove Windows Components --> select Management and Monitoring Tools --> click on Details --> select WMI Windows Installer Provider and then install the component.

Citrix server entered into a grace licence period

Grace Period Overview

The licensing grace period for Citrix Presentation Server is 30days. Each server maintains a copy of the available licenses in memory. So let's suppose you're licensed for 100 concurrent connections and you've got 5 servers in the farm. If your Access Suite License server goes down, your five servers will go into their 30day grace period and EACH ONE will be able to give out 100 licenses, enabling your farm to reach a total of 500 concurrent connections. However, Presentation Servers MUST be able to contact an Access Suite License server and pull a Citrix Start-up license when they boot or no users will be able to login.

A grace period is when the citrix presentation server has lost its connection to the citrix license server, the server will go in to a 30 day grade period where the server will still function with out any problems.  But as soon as the 30 days are up the citrix presentation server will stop accepting ICA connections.

Symptom

When Citrix server enters into a grace period, you will get the following event (Event ID: 9015).



























How to check problem has been resolved

You will get the following event (Event ID 9016) in Application Log Event Viewer.



























Things you need to check
  1. Generally default port 27000 is being used to communicate with the license server. Try to telnet the port. Here my license server IP is 192.168.1.100. To test the port connectivity I will use the following command:
     

    Telnet 192.168.1.100 27000

     
    If DOS command screen goes blank then communication is fine to the Citrix license server. If the DOS screen hangs and times out, then there must be some sort of communication issue.

    I executed the following command.
     


    Here is the output.


    That means the communication port 27000 is working perfectly. I checked the event viewer for the event 9016,  and didn't get any event like that. I then perform the following steps.
     
  2. Login to the license server and restart the following services.

     
    Citrix Licensing
    Citrix Licensing Support Service


    After restarting these license services I checked the event viewer for the event 9016, and didn't get any event like that. I then perform the following steps.
     
  3. I entered a wrong license server name through Citrix Access Management Console, applied the settings and then entered the correct license server name again.

    Now I searched for the Event ID 9016 and ultimately got that.

Citrix: Error - Health Monitoring and Recovery test failed

I have modified the Health Monitoring and Recovery test and included CheckLHC.exe to monitor Local Host Cache (LHC) health.

Local Host Cache - CheckLHC.exe
Check Local Host Cache performs an integrity and consistency test on the local Citrix Presentation Server’s local host cache (LHC). The integrity check ensures that the data stored in the LHC is not corrupted while the consistency check ensures no duplicate LHC entries. These operations are similar to those in other Presentation Server utilities found in DSCheck and DSVerify. Because this test can be CPU intensive, it is recommended to use a longer test interval of 12 hours (43,200 seconds) while keeping default values for the test threshold and timeout.

You have to download HMR Test Pak from http://support.citrix.com/article/CTX123197 and then install the package. The CheckLHC.exe will be stored in the following location (on 32 bit server):

"C:\Program Files\Citrix\HealthMon\Tests\Citrix\CheckLHC.exe"

Now use Health Monitoring & Recovery from the farm property to add CheckLHC test.

 HMR Error
On Citrix Access Management Console I got the following error:





On investingating, I found the following Application error in Event Viewer.































Causes
This issue starts to occur after installing the latest Health Monitoring and Recovery Test Pack because of missing permissions on certain registry keys and NTFS folders or files on your XenApp Server. For the Local Host Cache Health Monitoring and Recovery test to run successfully there are registry, directory, and file permission that need to have the Local Service account added with specific permissions. Without these permission set correctly you will continue to see this issue.

Resolution
Citrix has provided a utility (LHCTestAclsUtil.exe) in the Health Monitoring and Recovery Test Pack to add these permissions to your XenApp servers automatically. 

When you first install the Health Monitoring and Recovery Test Pack on a XenApp Server the (LHCTestAclsUtil.exe) executable is added to that server in one of the following locations depending on your Operating System Architecture:
For 64-bit location:
C:\Program Files (x86)\Citrix\System32\LHCTestAclsUtil.exe
For 32-bit location:
C:\Program Files\Citrix\System32\LHCTestAclsUtil.exe






To run open Command Prompt, go to the specified location and run LHCTestAclsUtil.exe.



When the utility asks whether or not the user is willing to allow these setting changes, specify Y for yes to accept and add Local Service account Read/Write access and complete the setup. As shown below:





Once the utility completes and the above permissions have been set correctly, you should see a new message in the Application Event Log on your server which specifies that the LHC test successfully ran and passed and is now assumed to be in a passing state.