Coming to you from the mind of Neil Glick (The Brain), a good old fashion, home cooked technical blog regarding storage, virtualization, and anything else that crosses my mind.
All Opinions Are My Own.
If you want to reach me on Twitter, I'm @meneilg

Wednesday, December 3, 2014

I'm doing a bunch of testing with VMware Horizon with View using Linked Clones and I'm creating, deleting, creating, deleting, creating, deleting, well, you get the point. Inevitably with so much creating and deleting I get stuck desktops.... What is a "stuck" desktop? Well, it's a desktop that you tell Horizon do delete and it thinks and thinks and thinks, but no deleting happens. Lousy rotten clone, I'll show you who's boss!!!

So I go into vCenter right click those suckers and delete them! Ha Ha! I'm the boss of you clones!!

But my smug demeanor is rapidly deflated when I go back into Horizon and see the desktops are still stuck at "deleting" as well as "missing". ARGH!!!

AND.... I have a Linked Clone Replica(s) stuck in vCenter. I think those are protected from removal or deletion by vCenter. So, you not only have desktops stuck in purgatory, but you also have a replica(s) that can't be removed either.

Okay, so what the heck to do you do? Well, there's lots of articles on the Internet, and there's different approaches. The first thing is you have to do is determine is this production, or is this an environment that can be trashed a little or a lot? Since I'm working in a lab environment, I can trash it, but I'd hate to have to rebuild EVERYTHING!! So I thought I'd show you how to clean up your environment if it's NOT production.

WARNING - I suggest taking a backup before you try any of this as it IS destructive. If you destroy your environment, I'm not responsible, so please don't blame me!!

WARNING - Remember, these procedures are NOT for production, and if this is dev/test, but you've got lots of stuff you want to keep in your Composer database, move along, this is not the solution you're looking for....

Okay, so you've got a bit of a mess on your hands. You've got a bunch of "deleting(missing)" desktops, replica(s) that won't go away and you just wish it would all go away. Maybe into a cornfield??

Like I said, there's lots of articles out there, but I wanted to show you a destructive way to clean everything up so you can get moving quickly if you don't have anything worth saving.

1. Clean up your ADAM database to get rid of the "deleting(missing)" desktops in Horizon.

This step is pretty easy. Follow this VMware KB to open your ADAM database on your Horizon with View Connection Server. This is the server that has the Horizon web administrative tool on it. The only thing to watch out for is if you're using Remote Desktop. I had trouble connecting to the ADAM database using domain administrator and Remote Desktop. The article tells you to use a user with elevated privileges, but it didn't work for me, so I consoled into the server using vCenter and that worked. Use the first part of this VMware KB to find and delete the desktops in the ADAM database once it's been opened.

2. Clean the View Composer Database.

All those "deleting(missing)" desktops are gone! You're good to go right? Not so fast Mr.! The Composer database still has all of those desktop references in it.

There's another section in that last KB about cleaning up your Composer database and I'd recommend following it if this is not a dev/test environment that you can trash.

So here's what I do. Log onto your Composer server and de-install Composer. Next log onto your SQL Server that has your Composer database and delete that database. I told you this is destructive!!

3. Get rid of the replica(s) from vCenter.

Okay, another method that I don't recommend if this is not a sandbox environment. Log into vCenter and browse the datastores that the Linked Clones and replica(s) are using. Delete all of the Linked Clone and replica folders of the machines you want to get rid of. Don't just delete everything! :-)

You'll notice you can't remove or delete the replica from inside vCenter, so we have to go to the ESXi server the replica(s) lives on.

Find out what ESXi server the replica is living on and log into the GUI of that ESXi server.

You'll notice from here you CAN remove the replica now. HURRAY!

Remove the replica from inventory, but you'll notice it's STILL in vCenter and listed as orphaned. Never fear, we'll get rid of that sucker! Go back to vCenter, put the ESXi server into maintenance mode, disconnect and remove it from inventory. Wo, wo, wo wo!!! Isn't this a bit extreme? Yes, yes it is. But remember this is a quick and dirty way to get rid of the replica(s). Add the ESXi server back into inventory, exit maintenance mode and you'll notice the replica is gone!! Is this the best way to get rid of replicas? Probably not, and I'm guessing it's not a best practice from VMware either so use at your own risk. Big thanks to mwpreston.net for demonstrating this method of removing stuck replicas.

4. Create your Composer Database.
If you remember we deleted our Composer Database earlier and it's time to create a new one. I suggest using the same name so you don't have to change ODBC connections. Give it the same permissions it had before too.

5. Re-install Composer.
Go back to your Composer machine and make sure your ODBC connection still works. When you're sure the connection is good, re-install Composer and point to the newly created database with the same name.

6. Some last cleanup.
We're good now right? Well.... Maybe.... I've had some trouble with the Composer connection in the VMware Horizon View Administrator tool after I've de-installed and re-installed. The secure certificates didn't want to work anymore and the connection from the administrator tool wouldn't connect to Composer anymore. I think this is because I de-installed and re-installed Composer, but who knows for sure. :-)

The easiest thing is to go into the View Configuration > Servers and delete your vCenter Server connection from inside the View Administrator. When you re-add it, add your Composer again and it should connect okay now. Remember to make sure the Domain connection is working too when you add your Composer connections. You'll probably have to re-enter it when you click on the Verify Server Information button.

Well that should do it. Everything should be working and you've got a crisp clean Composer database.