Tuesday, June 28, 2011

Removing VMs from the ADAM Database (Manually)

Yet another great KB that saved me a lot of hassle today: 1008658

Removing the virtual machine from the ADAM database

These steps are only applicable if the virtual machine has not been deleted from vCenter Server:
Find the virtual machine's GUID stored in ADAM:
  1. Log in to the culprit virtual machine using the vSphere Client Console or directly using Windows Remote Desktop Protocol (RDP).
  2. Open the Windows registry, and go to HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware VDM\Node Manager\Server DN.
  3. Record the cn=.

If the virtual machine has already been deleted from vCenter Server:

  1. Log in to the machine hosting your VMware View Connection Server through the VMware Infrastructure Client or Microsoft RDP.
  2. Open the ADAM Active Directory Service Interfaces Editor.
    • In a Windows 2003 Server, click Start > Programs > ADAM > ADAM ADSI Edit.
    • In a Windows 2008 Server, click Start > All Programs >Administrator Tools > ADSI Edit.

  3. Right-click ADAM ADSI Edit and click Connect to.
  4. Ensure that the Select or type a domain or server option is selected and the destination points to localhost.
  5. Select Distinguished Name (DN) or naming context and type dc=vdi, dc=vmware, dc=int.
  6. Run a query against OU=Servers, DC=vdi, DC=vmware, DC=int with the this string:

    (&(objectClass=pae-VM)(pae-displayname=))


  7. Record the cn=.

Take a complete backup of ADAM and Composer database.

Delete the pae-VM object from the ADAM database:
  1. Open the ADAM Active Directory Service Interfaces Editor.
    • In a Windows 2003 Server, click Start > Programs > ADAM > ADAM ADSI Edit.
    • In a Windows 2008 Server, click Start > All Programs >Administrator Tools > ADSI Edit.

  2. Right-click ADAM ADSI Edit and click Connect to.
  3. Choose Distinguished name (DN) or naming context and type dc=vdi, dc=vmware, dc=int.
  4. Locate the OU=SERVERS container.
  5. Locate the corresponding virtual machine's GUID (from above) in the list which can be sorted in ascending or descending order, choose Properties and check the pae-DisplayName Attribute to verify the corresponding linked clone virtual machine object.
  6. Delete the pae-VM object.
Note: Check if there are entries under OU=Desktops and OU=Applications in the ADAM database.
Removing the linked clone references from the View Composer database
In View 4.5 and later, use the SviConfig RemoveSviClone command to remove these items:
  • The linked clone database entries from the View Composer database
  • The linked clone machine account from Active Directory
  • The linked clone virtual machine from vCenter Server
Before you remove the linked clone data, make sure that the View Composer service is running. On the View Composer computer, run the SviConfig RemoveSviClone command.
For example:

SviConfig -operation=RemoveSviClone
-VmName=VM name -AdminUser=the local admin user -AdminPassword=the local admin password -ServerUrl=the View Composer server URL

Where:
VmName - The name of the virtual machine to remove.
AdminUser - The name of the user who is part of the local administrator group. The default value is Administrator.
AdminPassword - The password of the administrator used to connect to the View Composer server.
ServerUrl - The View Composer server URL. The default value is https://localhost:18443/SviService/v2_0
The VmName and AdminPassword parameters are required. AdminUser and ServerUrl are optional.
Note: The location of SviConfig is:
    • In 32-bit servers – \Program Files\VMware\VMware View Composer
    • In 64-bit servers – \Program Files (x86)\VMware\VMware View Composer
In View 4.0.x and earlier, you must manually delete linked-clone data from the View Composer database.
To remove the linked clone references from the View Composer database:
    1. Open SQL Manager > Databases > View Composer database > Tables.
    2. Open dbo.SVI_VM_NAME table and delete the entire row where the virtual machine is referenced under column NAME.
    3. Open dbo.SVI_COMPUTER_NAME table and delete the entire row where the virtual machine is referenced under column NAME.
    4. Open dbo.SVI_SIM_CLONE table, find the virtual machine reference under column VM_NAME and note the ID. If you try to delete this row it complains about other table dependencies.
      • Open dbo.SVI_SC_PDISK_INFO table and delete the entire row where dbo.SVI_SIM_CLONE ID is referenced under column PARENT_ID.
      • Open dbo.SVI_SC_BASE_DISK_KEYS table and delete the entire row where dbo.SVI_SIM_CLONE ID is referenced under column PARENT_ID.
      • If the linked clone was in the process of being deployed when a problem occurred, there may be additional references to the clone left around in the dbo.SVI_TASK_STATE table and dbo.SVI_REQUEST table:
        • Open dbo.SVI_TASK_STATE table and find the row where dbo.SVI_SIM_CLONE ID is referenced under column SIM_CLONE_ID. Note the REQUEST_ID in that row.
        • Open dbo.SVI_REQUEST table and delete the entire row where dbo.SVI_TASK_STATE REQUEST_ID is referenced ID.
        • Delete the entire row from dbo.SVI_TASK_STATE table

    5. In dbo.SVI_SIM_CLONE table, delete the entire row where the virtual machine is referenced.
    6. Remove the virtual machine from Active Directory Users and Computers.

Deleting the virtual machine from vCenter Server

Note: If you run the SviConfig RemoveSviClone command to remove linked clone data, the virtual machine is removed from vCenter Server. You can skip this task.
To delete the virtual machine from vCenter Server:
  1. Log in to vCenter Server using the vSphere Client.
  2. Right-click the linked clone virtual machine and click Delete from Disk.

No comments:

Post a Comment