Pages

Tuesday, May 28, 2013

Identifying which VMware View replica belongs to which virtual desktop

One of the common issues I’ve come across over the past few months for clients was when I was asked to identify which replicas belonged to which virtual desktops in VMware View environments because a lot of my clients suspected that they had orphaned replicas that were not in use.  When approached with such a request, I usually perform one of the following 3 options:

Option #1 – Use the SviConfig.exe command to find unused replicas

VMware actually provides an official KB that demonstrates how to use the SviConfig.exe command to generate a unused-replica-*.txt file that lists replicas that it is able to identify as being unused.  While I’ve found that this doesn’t always work because I’ve had several occasions where the txt file generated was empty, this is the safest route to take. 

Finding and removing unused replica virtual machines in VMware View (2009844)
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2009844

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

Option #2 – Identifying replica mappings through the ESXi console

Another VMware KB that is available demonstrates how to generate a txt file that contains all of the replica to virtual desktop mappings which can then be used to identify which replicas are actually in use.  I find that this process can potentially be prone to human errors so steps such as renaming the identified replica folders and leaving them for a week rather than deleting them outright should be taken.  The KB that outlines the steps is the following:

Determining which replica disk is used for a linked clone virtual machine (1031842)
http://kb.vmware.com/selfservice/microsites/search.do?cmd=displayKC&docType=kc&docTypeID=DT_KB_1_1&externalId=1031842

As I found that the process can potentially be confusing, I’ve documented one of steps I recently went through so that I can reference it in the future:

Begin by executing the following command to find the replicas in the VMX files:

find /vmfs/volumes/ \( -size -1500c \) -name *.vmdk -exec grep replica {} -H \; | grep 'parentFileNameHint=' > replicalist.txt

Use the following command to format the replica information dumped into replicalist.txt and output it to replicalist2.txt:

sed s/:/'-->>'/ < replicalist.txt >replicalist2.txt

From here, the KB article suggests to use the less replicalist2.txt command to view the information but I found that it’s not easy to copy the information from the putty session so simply use the cp command to copy the replicalist2.txt file into a regular VMFS store then use the VMware vSphere Client to download it:

cp /replicalist2.txt /vmfs/volumes/LUN01-ISO/

image

Proceed with downloading the replicalist2.txt file onto your desktop or laptop and opening the file which should look similar to the following:

image

Note that all each virtual desktop is represented by the block of text similar to the following:

/vmfs/volumes/4f6480d0-73e03584-c40c-0025b500000c/VIEW4-011_1/VIEW4-011.vmdk-->>parentFileNameHint="/vmfs/volumes/4f6480d0-73e03584-c40c-0025b500000c/replica-496f01b1-630d-4b04-8872-/replica-496f01b1-630d-4b04-8872-.vmdk"

With the replica information in the text file begin traversing through the list of replicas listed in your vCenter:

image

… and copy each replica:

replica-006164ad-adfe-4fbb-92e6-e32edc60e24f

What’s important to note is that you will need to remove the last string of characters highlighted in red as shown above so that you only have the following:

replica-006164ad-adfe-4fbb-92e6

With the truncated text shown above, perform a search in the text file:

image

Pay attention to the results that the find feature returns as you are expected to get a return from all of the results because the replicalist2.txt file contains references to the replicas themselves stored on the VMFS stores.  The key here is to determine whether the replica ID shows up on a line that is linked to a virtual desktop and in the example below, it doesn’t:

image

With this in mind, what this means is that we should be able to unprotect the replica:

Removing orphaned replicas in VMware View 4.6 with sviconfig.exe
http://terenceluk.blogspot.com/2013/03/removing-orphaned-replicas-in-vmware.html

… rename the folder containing the replica on the VMFS store, and then wait a few days before deleting it.  Make sure you’re just renaming the replica in the VMFS folder and not the actual replica in vCenter in case you need to quickly roll back.  Once you’ve confirmed that the replica is indeed not in use because all the virtual desktops continue to be in good health, proceed by renaming the folder that was renamed and then right clicking on the replica in vCenter then delete.

As the example above showed a replica that is orphaned, the following is a demonstration of one that is being used:

replica-07c8e7df-449e-4372-8701-b4e7519223e0

replica-07c8e7df-449e-4372-8701

image

Notice how the following find research brings us to a line that is associated with a virtual desktop named VIEW46-001:

image

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

Option #3 – Recompose all desktops with a new snapshot

Another option I’ve found to be the easiest way to clean up old replicas is to perform a recompose of all of the virtual desktop pools with a new snapshot then remove any replicas that are not dated the day of the rollout.  The reason why we can do this is because if all of the desktops are using the new snapshot that was created, the old replicas should get automatically deleted by View and if they are indeed orphaned then you should at least be able to safe rename the folder in the datastore, wait a few days then delete them. 

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

Another possible alternative that I thought would have been a good was a post someone mentioned in the VMware forums:

In a small environment you may be able to locate the linked clones by browsing the database tables

From the Composer database:

    1.    In dbo.SVI_SIM_CLONE, get the REPLICA_ID from the row that the linked clone virtual machine is shown under VM_NAME.

    2.    In dbo.SVI_REPLICA, match the REPLICA_ID found in step 1 under the ID column and get the value for that row under REPLICA_MOID.

http://communities.vmware.com/thread/340859?start=0&tstart=0

Unfortunately, the columns referenced in the tables did not appear to show the mappings so while it would have been nice to be able to use SQL queries to identify the orphaned replicas, it does not appear to be possible to do this.

Tuesday, May 14, 2013

Lync Server Access Edge service fails to start with: “… service-specific error code -2146762487”

Problem

Lync Server 2013 Role: Lync Edge

Base Operating System: Windows Server 2012

You attempt to start your Lync Server 2013’s Edge server’s Lync Server Access Edge service but notice that the service fails with the following message:

Windows could not start the Lync Server Access Edge on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to the service-specific error code -2146762487.

clip_image001

clip_image001[4]

Reviewing the System logs on the Edge server show event ID 7024 errors logged:

image

The Lync Server Access Edge service terminated with the following service-specific error: A Certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.

image

You confirm that the root certificate issuing your Edge server’s certificate is listed in the Trusted Root Certification Authorities:

image

You review the certificate assigned to the external interface for the Edge server in the MMC and notice that the certificates in the chain are all listed as This certificate is OK.:

imageimageimage

Solution

For those who have came across one of my previous posts:

Lync Server 2013 Edge server replication issues on Windows Server 2012
http://terenceluk.blogspot.com/2013/04/lync-server-2013-edge-server.html

… will know that I’ve ran into a few challenges with Lync Server 2013 Edge servers on a Windows Server 2012 operating system.  As noted in the post above, Windows Server 2012 is more stringent when it comes to trusted certificates and actions such as mistakenly putting an intermediate certificate in the trusted root certificate store can cause replication to stop working between the Edge and front end server.  What was interesting about this problem indicated in this post is that I had the issuing root certificate on the server’s Trusted Root Certification Authorities and while all indications point to the server trusting the certificate being used by the Edge server, the services did not.  What I ended up having to do to correct this problem was import the intermediate certificate in the chain into my Intermediate Certification Authorities:

clip_image001[6]

https://certs.godaddy.com/anonymous/repository.pki

clip_image001[8]

clip_image001[10]

clip_image001[12]

A bit strange but something I can live with going forward.

Tuesday, May 7, 2013

Non local administrators are unable to browse and access network shares when logged onto Citrix XenApp 6.5 servers

Environment

Citrix XenApp Server Operating System:  Windows 2008 R2

Citrix XenApp Version: 6.5

Citrix XenApp Hotfix: Rollup 1

Citrix Profile Management Version: 4.1

Problem

You’ve received complaints from various users that when they launch applications published on the Citrix XenApp 6.5 servers, they receive Windows Script Host error prompts similar to the following:

Script:

\\domain.internal\SysVol\domain.internal\Policies\{someGuid}\User\Scripts\Logon\logon.vbs

Line: 16

Char: 1

Error: Permission denied: ‘GetObject’

Code: 800A0046

Source: Microsoft VBScript runtime error

image

To further troubleshoot, you proceed by configuring the XenApp server to allow users to directly remote desktop to the server.  Upon directly logging onto the server with the user’s credentials, the following is displayed:

image

While troubleshooting the issue, you also noticed that you are unable to browse the path:

\\domain.internal

image

Windows cannot access \\domain.internal

You do not have permission to access \\domain.internal. Contact your network administrator to request access.

For more information about permissions, see Windows Help and Support

image

The server also exhibits the same behavior when you browse directly to a server via the name or IP:

clip_image001[4]clip_image001[6]

What’s strange is that you are able to ping other servers:

image

You notice that if you add the user to the local administrators group, the error goes away. 

Solution

While the symptoms described in the following KB:

http://support.citrix.com/article/CTX128255

… did not directly map to the ones described above, I found that the solution was resolved my issue.  The reason why non local administrators were experiencing these symptoms is because of the UsrClass.dat file located in the following directory when the user is logged onto the server:

C:\Users\Default\AppData\Local\Microsoft\Windows

image

You will also notice the same file stored on the file server that stores the user’s profile management folder:

\\someFileserver\profilemanagement\someUsername\UPM_Profile\AppData\Local\Microsoft\Windows

image

The solution as described in the article is to delete this file but note the following:

  1. You may not be able to delete the UsrClass.dat file from C:\Users\Default\AppData\Local\Microsoft\Windows while the user is logged in
  2. Even if you delete the file while the user is logged off, the saved UsrClass.dat will be copied back to the server from the server

To correctly resolve the issue and remove the problematic UsrClass.dat file, first log off as the user to make sure profile management has saved the user’s profile on the file server and no other sessions will overwrite the profile, then go to the user’s profile on the file server and delete UsrClass.dat.  Once this is done, log back onto the server as the user and and ensure the symptoms are gone.

Saturday, May 4, 2013

Installing SQL Server 2008 R2 Management Tools fails with the error: “Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installation to SP1 level, by visiting Microsoft Update.”

Problem

You attempt to install SQL Server 2008 R2 Management Tools on a server or desktop:

clip_image001

but notice that it fails with the error:

Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installation to SP1 level, by visiting Microsoft Update.

clip_image001[4]

Your SQL Server 2008 R2 setup operation has been cancelled.

Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1.  Please update all Visual Studio 2008 installations to SP1 level, by visiting Microsoft Update.

clip_image001[6]

You attempt to download Microsoft Visual Studio 2008 Service Pack 1 (Installer) from the following URL:

http://www.microsoft.com/en-us/download/details.aspx?id=10986

clip_image001[8]

… but when running the install throws the following error:

Setup has detected that this computer does not meet the requirements to install this update. The following flocking issues must be resolved before you can install Microsoft Visual Studio 2008 SP1 software update.

Installation Requirements:

A compatible version of Visual Studio 2008 was not detected on the system. This update is designed for only the Microsoft Visual Studio 2008 (ENU) product family, and is not compatible with any Express editions.

clip_image001[10]

Solution

This probably was a difficult one to resolve as it took me quite a bit of searching to find a solution and the time it took to find an answer is why I choose to write this post in hopes that I could help someone who may experience the same problem.  What ended up working for me was instructions a user posted in the following thread:

http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/baf09c3f-be97-4bc8-b6d7-bdeea2e3719e

I went ahead and located the SP and SPIndex REG_DWORD attributes in the following registry keys:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0
  • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0\VSR\1033


… and changed the values from 0 to 1:

clip_image001[12]clip_image001[14]

Changed to 1:

clip_image001[16]clip_image001[18]

The user also suggested to change SPName REG_SZ to RTM but I did not have to do this as the install successfully completed with the previous changes:

clip_image001[20]

Friday, May 3, 2013

Citrix XenDesktop 5.6 virtual desktops continuously prompts the message: “You must restart your computer to apply these changes”

Problem

You’ve completed a new build of a Windows 7 master image desktop for XenDesktop 5.6 and proceed with creating the new desktop catalog and add the desktops to a desktop group.  Once the desktops have been deployed, you continue by connecting a desktop in the pool but noticed that you receive the following prompt with the following message:

You must restart your computer to apply these changes

Before restarting, save any open files and close all programs.

image

You’ve confirmed that your master image does not prompt you for a restart but noticed the desktops in the pool always do.

Solution

This issue was new to me because throughout all of the deployments I’ve done with XenDesktop, I’ve never encountered this.  The only difference between this deployment and all of the others is that this one is built on vSphere 5.1 with vCenter build 947673 and ESXi build 1065491 hosts (my previous deployments are either 4.1 or 5.0).  A quick search on Google reveals the following Citrix KB:

Case Study: MCS-Created Windows 7 VDAs Display 'You must restart your computer to apply these changes' Error Message when Starting
http://support.citrix.com/article/CTX132721

While the environment described in this article does not directly match mine (especially because the hypervisor is Microsoft Hyper-V 2008 R2), I went ahead and tried using the instructions to see if it would correct my problem.  The following are the steps I performed:

  1. Shutdown master image
  2. Add an additional disk by using an existing identity disk from another desktop in a pool
  3. Power on master image
  4. Restart the master image a few times
  5. Shutdown master image
  6. Remove identity disk
  7. Create a new snapshot for the master image
  8. Update catalog with new snapshot

The Good News:

One of the unexpected behaviors I noticed was that I did not receive a prompt asking me to restart after adding the identity disk to the master image but I can confirm that after performing these steps, the desktops in the pool no longer prompted me to restart the desktop as if it had found and installed new hardware. 

The Bad News:

This was great news until I logged into the master image and noticed that the name of the master image was now the name of the desktop that owned the identity disk I used to attach to the desktop.  I didn’t think too much about this being issue as I figure it probably copied the identity information from the desktop in the pool but what I noticed was that as soon as I changed the name of the master image back to the original, removed it from the domain and restarted, the radio button to join the desktop to the domain would be grayed out:

clip_image001

What makes it more strange is that if I change it back to the same name as the desktop that I used the identity disk and reboot, the option will be available again:

clip_image001[4]

The Workaround:

This was definitely an odd behavior and I wasn’t about to go live with such an issue.  After trying various operations with the master image without any luck, I went ahead and reverted back to a snapshot prior to attaching the identity disk.  Seeing how it appears adding the disk to the master image and booting it up caused Windows to assume the identity provided by the identity disk, I proceeded to try adding the disk without booting up with it.  With the master image powered on, I went to the master image’s virtual machine settings and performed a hot add of the identity disk:

clip_image001[6]

clip_image001[10]

clip_image001[12]

clip_image001[16]

clip_image001[8]

I continued by clicking OK to apply the changes, went to the console of the master image to confirm that identity disk shows up and then went ahead to remove the disk from the master image:

clip_image001[20]

Once the disk was removed, I restarted the master image a few times, created a new snapshot then updated the desktop catalog.  Once the update to the base disk was complete, I noticed that the virtual desktops in the pool no longer prompted for a restart as if new hardware was found and installed.

Increasing vCPU and memory for Citrix XenDesktop 5.6 virtual desktops

I’ve recently been asked about how to change the amount of vCPU and memory for Citrix XenDesktop desktop catalogs that have already been deployed and as XenDesktop administrators would know, the following screen with configuration parameters to set the vCPU and memory is presented when creating the new desktop catalog:

clip_image001

However, once the desktop catalog has been created, we no longer have access to these options.  Manually changing the master image and/or the VDI desktops doesn’t work because subsequent desktops that are deployed will be configured with the same vCPU and memory as originally specified.

The solution to this is actually quite simple and that is to use PowerShell cmdlets to change the configuration for the desktop catalog.  The following are the PowerShell cmdlets we’ll need to change these settings:

Get-ProvScheme
http://support.citrix.com/static/kc/CTX127254/help/Get-ProvScheme.html

Set-ProvScheme
http://support.citrix.com/static/kc/CTX127254/help/Set-ProvScheme.html

Changing Memory for Desktops

Begin by using the Get-ProvScheme to get the ProvisioningSchemeName for the pool you would like to modify:

PS C:\Users\tluk> Get-ProvScheme

ProvisioningSchemeUid    : 98ba4e9e-4b29-4ca7-885a-f689b664a2ed

ProvisioningSchemeName   : London_svrvcenter03

CpuCount                 : 1

MemoryMB                 : 4096

DiskSize                 : 40

MasterImageVM            : XDHyp:\HostingUnits\svrvcenter03\Normal.resourcepool\win7ent64tmp.vm\Snappy.snapshot

MasterImageVMDate        : 4/26/2013 2:20:41 PM

IdentityPoolUid          : 499727d7-3648-454a-9a30-1c934efffca1

IdentityPoolName         : London

HostingUnitUid           : 935be19a-7941-465e-9377-1673962f7525

HostingUnitName          : svrvcenter03

CleanOnBoot              : True

TaskId                   :

Metadata                 : {Citrix_DesktopStudio_UpdateId = 113152a9-82eb-4595-808e-9d1725d7c6dc:6cea07ff-1c5a-4b1e-80f8-a252e9b7984c}

MachineCount             : 5

ControllerAddress        : {svrctxddc01.domain.internal, svrctxddc02.domain.internal}

VMMetadata               : {H, 4, s, I...}

UsePersonalVDiskStorage  : False

PersonalVDiskDriveLetter :

PersonalVDiskDriveSize   : 0

PS C:\Users\tluk>

image

Make a note of the ProvisioningSchemeName and then use the Set-ProvScheme to set the new memory:

Set-ProvScheme -ProvisioningSchemeName "London_svrvcenter03" -VMMemoryMB "8192"

image

Note that you won’t receive an output when executing the Set-ProvScheme cmdlet.

To confirm that the changes to the pool have been applied, use the Get-ProvScheme command to display the pool properties:

image

Changing vCPU for Desktops

Changing vCPUs (CpuCount) is similar to memory but rather than using VMMemoryMB switch, use the VMCpuCount as shown in the following:

Set-ProvScheme -ProvisioningSchemeName "London_svrvcenter03" -VMCpuCount “2”

image

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

Note that changing these settings will only apply to new desktops deployed for the pool and not for existing desktops.  This means that if you had 200 desktops in the pool, simply executing updating the catalog with a new snapshot will not change the CPU or memory.  The only way to update them would be to use vSphere PowerCLI to change the settings for the existing VDIs or delete them and recreate the desktops if they are not persistent.