Sunday, November 24, 2013

Powershell Command to Check user Permission on xenapp farn


Get-XAAdministrator "UserName"

Powershell Command to add new custom admin in Citrix Xenapp Console



New-XAAdministrator domainname\username -AdministratorType Custom -FarmPrivileges ViewFarm, LogOnConsole

Find out VM registered on esx hosts when Virtual Center is DOWN

use below sql query to find out any particular virtual machine when vCenter Server is down .

Steps are :--

1. Log in to the Microsoft SQL 2005/2008 Server running on the sever i.e. osekimw201 .

2. Open SQL Management Studio.

3. Select the virtual center database i.e. virtualcenter_db.

4. Open a new query window.

5. Run this SQL statement :

SELECT vpxv_vms.vmid, vpxv_vms.NAME, vpxv_vms.hostid, vpxv_hosts.NAME
FROM vpxv_vms
JOIN vpxv_hosts on VPXV_VMS.HOSTID = VPXV_HOSTS.HOSTID
WHERE (
(vpxv_hosts.hostid = vpxv_vms.hostid)
AND (vpxv_vms.NAME = 'virtual machine name ')
)

This query returns the virtual machine ID, virtual machine name, host ID, and host name.

Saturday, November 23, 2013

Script to get Citrix Xenapp offline server information over Email.

Script to get Citrix Xenapp offline server information over Email.

Create one Bat file and one VBScript.

Bat file to run qfarm /offline command and save the output in text file i.e. offline.txt and call mail.vbs file to send email

VBScript will send offline.txt data via Email.

Make sure you have information about SMTP server and port 25 needs to be open between Citrix server from which you

send email to SMTP server.

Valid email ID‘s

Service account should have rights on Citrix servers to run Qfarm /offline command.

Copy both file at same location like c:

Create Schedule task to get run bat file daily

Bat File Code:-

--------------------------------------------------------------------

cd c:

qfarm /offline >offline.txt

cscript mail.vbs

-----------------------------------------------------------------------

Save Bat file as offline.bat

Vbscript Code:-

-------------------------------------------------------------------------

Set objFSO = CreateObject("Scripting.FileSystemObject")

set objMailBody = objFSO.OpenTextFile(".\offline.txt", 1)

BodyText = objMailBody.ReadAll

Set objEmail = CreateObject("CDO.Message")

objEmail.From = "donotreply@abc.com"

objEmail.To = "nitin@abc.com"

objEmail.Subject = " Offline servers - Auto Generated Email"

objEmail.Textbody = BodyText

objEmail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

objEmail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _

"192.168.1.2"

objEmail.Configuration.Fields.Item _

("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

ObjEmail.AddAttachment "c:\offline.txt", "Picture", 1

objEmail.Configuration.Fields.Update

objEmail.Send

----------------------------------------------------------------------------

Save VBscript as mail.vbs

Thursday, November 21, 2013

Registry value to check Logon Status of Citrix Xenapp 6.5 server

The logon's status is a combination of two keys, not just the one.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\TSServerDrainMode

AND

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\WinStationsDisabled

WinStationsDisabled =0 and TSServerDrainMode =0

Allow Logon and Reconnection (Allow all connections)

WinStationsDisabled =0 and TSServerDrainMode =1

Prohibit Logon until Restart (Allow reconnections, but prevent new logon until reboot)

WinStationsDisabled =0 and TSServerDrainMode =2

Prohibit Logon (Allow reconnections, but prevent new logon )

WinStationsDisabled =1 and TSServerDrainMode =0

Prohibit Logon and Reconnection

Query Inactive AD Computer Objects

dsquery computer -inactive 54 -limit 100000

LDAP Queries

LDAP Queries:-

Windows Server 2008 R2 Enterprise without any SP

(&(objectCategory=computer)(operatingSystem=Windows Server 2008 R2 *)(!operatingSystemServicePack=*))

Windows Server 2008 without SP2

(&(objectCategory=computer)(operatingSystem=Windows Server® 2008*)(!operatingSystemServicePack=Service Pack 2))

Windows Server 2003 without SP2

(&(objectCategory=computer)(operatingSystem=Windows Server 2003)(!operatingSystemServicePack=Service Pack 2))

What to Monitor on Citrix Products?

Citrix has published an Operations Guide for availability and performance monitoring. Citrix outlines all of the recommended counters, metrics, services, event IDs, ports etc. that they recommend should be monitored in a Citrix environment (XenApp, XenDesktop, XenServer, licensing services, Netscaler, etc.)

https://support.citrix.com/servlet/KbServlet/download/30998-102-686964/Operations%20Guide%20-%20Monitoring.pdf

Medevac XML/Ticketing Test result: Failure! — unspecified

When running Medevac 2.5 on my farm, I am getting ‘failed’ for all the results for ‘XML ticketing test’.

Medevac XML ticketing test fails for Citrix XenApp 6.5 server.

How to delete Profile and Home Drives

I observe that whenever user leave the organization / Move to another department / inactive for some time.

The IT Administrator deletes his/her User Account. Forget to delete his/her Home drive and Profile from Roaming profile location.

I have written a VB script will which will delete users Home drive and Profile only if users account doesn’t exist in AD.

I believe it’s OK to delete Users Profile or Home drive if User doesn’t have AD account