SCVMM 2012 | Force Remove vCenter Server

If you are reading this you likely took the plunge into Microsoft Virtual Machine Manager 2012, you added in your VMWARE vCenter, migrated some VM’s and then tried to jettison the old vCenter  that is no longer around.

If you did you likely got this error message:

VMM cannot complete the VMware operation on the <server> server because of the error: “Unable to connect to the remote server

image

You may have went for extra credit and run this powershell command without luck as well:

Get-VirtualizationManager -ComputerName <server> | Remove-VirtualizationManager

See unlike Remote-VMHost that has the –force switch you don’t have a –force switch with Remove-VirtualizationManager.

What is an admin to do??

Well if you are extremely irresponsible and want to blindly follow a guy with a blog who happened to find a way that at least looks like it worked then good Sir or Madam you are in the right place!!!

SQL Studio with Admin Rights

First you will need to run SQL Studio Manager with rights to the DB. If you have this then move on to the next section.

If like me you didn’t end up having permission to the default instance then run this nifty sysInternals tool PSEXEC:

PSEXEC –i –s cmd (make sure to run with admin rights)

If that works and you now have a cmd prompt go ahead and type whoami just for fun. you will see you are NT Authority\Local System!

Now go ahead and run the SQL Studio Manager from this command prompt. Given each version of SQL has this in a different location the easiest way would be to look at the properties of the start menu shortcut to find the full path to the executable.

The Query

Ah now once in SQL Studio with rights to the DB simple run this query to force remove the vCenter from your VMM instance.

HEY!!! SERIOUSLY I HAVE NO IDEA IF THIS IS SAFE!! USE AT YOUR OWN RISK.

DECLARE @computername varchar(255)
SET @computername = ‘<servername>’
DELETE FROM [tbl_ADHC_AgentServerRelation] WHERE AgentServerID = (select top 1 AgentServerID from tbl_ADHC_AgentServer where Computername = @computername)
DELETE FROM [tbl_ADHC_AgentServer] WHERE AgentServerID = (select top 1 AgentServerID from tbl_ADHC_AgentServer where Computername = @computername)
DELETE FROM [tbl_ADHC_Host] WHERE [HostID] = (select top 1 HostID from tbl_ADHC_Host where ComputerName = @computername)

Now, if I you know a better way please leave a comment.

If this helped you, please leave a comment. Love knowing my time wasn’t wasted.

If you are Microsoft and you feel I am leading people off a cliff, PLEASE PLEASE leave me a comment.

In any event, hope it helps and enjoy!

-Eric

About these ads

Tags: , , , , , ,

About Eric

My name is Eric Weintraub. I am an IT Professional with over 12 years of real world experience. I currently work as a Senior IT Manager for a large software company that develops products for Information Technology workers. Professionally, I love what I do and it shows in my work. Personally, I enjoy technology as a whole. Enterprise Technology, Social Media, and Mobile technologies are all things I follow. I also love to play golf, go snowboarding, cook, love to eat, and read. Also big on photography, check out my recent photography at http://www.ericweintraubphotography.com and also Flickr: http://www.flickr.com/photos/ericweintraub/. As much as I don’t have a lot of free time, I always come across things that I believe could help others. I just wanted to be able to share what I find with others. Thanks for reading the blog, please setup a RSS feed and keep in touch! Eric Weintraub

7 responses to “SCVMM 2012 | Force Remove vCenter Server”

  1. Anonymous says :

    One small change was required for the query to remove the server from the database:

    DECLARE @computername varchar(255)
    SET @computername = ”
    DELETE FROM [tbl_ADHC_VmwResourcePool] WHERE [HostID] = (select top 1 HostID from tbl_ADHC_Host where ComputerName = @computername)
    DELETE FROM [tbl_ADHC_AgentServerRelation] WHERE AgentServerID = (select top 1 AgentServerID from tbl_ADHC_AgentServer where Computername = @computername)
    DELETE FROM [tbl_ADHC_AgentServer] WHERE AgentServerID = (select top 1 AgentServerID from tbl_ADHC_AgentServer where Computername = @computername)
    DELETE FROM [tbl_ADHC_Host] WHERE [HostID] = (select top 1 HostID from tbl_ADHC_Host where ComputerName = @computername)

    Added line: DELETE FROM [tbl_ADHC_VmwResourcePool] WHERE [HostID] = (select top 1 HostID from tbl_ADHC_Host where ComputerName = @computername)

    The vCenter server was in the tbl_ADHC_VmwResourcePool as well in my VMM 2012 installation.

  2. Billy_Clark says :

    Thanks Eric

    Saved me a headache doing what Microsoft wanted:
    http://support.microsoft.com/kb/2730029

Trackbacks / Pingbacks

  1. SCVMM2012 Issue when trying to remove a VMWare vCenter | OpsMan - April 29, 2013

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: