How to find computers with same hostuuid and how to correct them?

Document ID : KB000009777
Last Modified Date : 17/05/2018
Show Technical Document Details
Introduction:

If machines have been built from a same ghost image containing the hostuuid, they could have the same ITCM hostuuid.

Only one machine with same hostuuid appear in ITCM console. How to find all machines with same hostuuid and how to correct them?

 

Background:

ITCM hostuuid is stored in registry key :

HKEY_LOCAL_MACHINE\Software\ComputerAssociates\HostUUID (or HKEY_LOCAL_MACHINE\Software\Wow6432Node\ComputerAssociates\HostUUID on Windows 64 bits machine).

2.jpg

It is created automatically by ITCM Agent when it starts for the first time.

If some machines are built from an installation OS Image containing this registry key, these machines will have the same ITCM hostuuid.

ITCM DOMAIN detects a duplicate hostuuid and stores in the database only one machine (the last machine which has communicated with DOMAIN).

So only one machine is displayed in ITCM console and others machines with same hostuuid do not appear.

Environment:
Windows machines
Instructions:

How to find the machines with duplicate hostuuid with a SQL Query ?

Following SQL Query could give you the list of machines with problem (machines which had the problem during the last 3 days) :

USE mdb
SELECT

DISTINCT A.hnew 'New Computer', B.hold 'Previous Computer', A.hold 'Hostuuid',
dateadd ( ss, A.hdate + datediff(ss,getutcdate(),getdate()), convert(datetime,'19700101')) 'Date'
FROM AMEPHIS A, AMEPHIS B
WHERE A.hterid=14
and A.hdate>datediff(ss, convert(datetime,'19700101'), getutcdate())-60*60*24*3
and
  (A.hnew COLLATE DATABASE_DEFAULT not in (SELECT label COLLATE DATABASE_DEFAULT FROM ca_discovered_hardware) or 
  A.hnew COLLATE DATABASE_DEFAULT in (SELECT label COLLATE DATABASE_DEFAULT FROM ca_discovered_hardware WHERE A.hold=host_uuid ))
and A.hdate=B.hdate and B.hterid=11
ORDER BY 2,1

This query could be executed with Microsoft SQL Server Management Studio.

In this example, JY-PC6 and JY-PC7 have the same hostuuid. But only JY-PC7 appears in ITCM Console :

3.jpg

 

 

How to create a ITCM Query returning the machines with duplicate hostuuid ?

A ITCM Query could also be created to find machines which have duplicate hostuuid :

1- In ITCM Explorer, Right click on Queries folder and select "New..." in order to create a new Computers query.

2- In Query Designer, Click on Advanced Argument and fill the fields like this :

Pseudo text : Duplicate Hostuuid
Table : -Any-
Additional WHERE clause :
SELECT A.hpriuuid FROM AMEPHIS A, AMEPHIS B WHERE A.hterid=14 and A.hdate>datediff(ss, convert(datetime,'19700101'), getutcdate())-60*60*24*3 and (A.hnew COLLATE DATABASE_DEFAULT not in (SELECT label COLLATE DATABASE_DEFAULT FROM ca_discovered_hardware) or A.hnew COLLATE DATABASE_DEFAULT in (SELECT label COLLATE DATABASE_DEFAULT FROM ca_discovered_hardware WHERE A.hold=host_uuid )) and A.hdate=B.hdate and B.hterid=11
 

4.jpg

Remark: SQL Query in "additional WHERE clause" should be put in a single line. Do not cut it with carriage return.

3- Click OK and save the query (ex: "Duplicate Hostuuid").

Execution of this query should return the list of all computers visible in ITCM Console which had a duplicate hostuuid problem during the last 3 days.

5.jpg

 

How to correct automatically the machines with duplicate hostuuid ?

The solution is to delete the registry value HKEY_LOCAL_MACHINE\Software\ComputerAssociates\HostUUID\HostUUID

in order to have a new HostUUID generated automatically when CAF is restarted on the machine.

This could be done via a Asset Job of type script :

 

1- In DSM Explorer, expand Jobs folder and right click on "Asset Jobs" folder. Click New and select Script as Job Type. Then click Next button

6.jpg

 

2- Give a name for the job (ex : Delete HostUUID) and click Next button.

In the script text enter this :

DIM hkey1 as integer
hkey1 = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ComputerAssociates\hostUUID")
IF hkey1 <> 0 THEN
   RegDeleteVariable(hKey1, "HostUUID") THEN
   RegCloseKey(hKey1)
ENDIF

 

7.jpg

click Next button.


3- Click on "Set Scheduling..." button. 

Select "Run only once" in "Scheduling" tab

9.jpg

and in "Miscellaneous" tab, check option "This job is allowed to run unattended"

 

 10.jpg

4- Click OK and Finish to terminate the Asset Job creation.

 

5- Under Computer and Users, create a new dynamic group based on Query "Duplicate Hostuuid" created above.

Select an Engine for evaluation and a period (ex: every 60 minutes).

11.jpg

This group will contain all machines visible in ITCM Console which had a problem with duplicate hostuuid during the last 3 days.

 

12.jpg

 

5- Drag & Drop (or Copy/Paste) the Asset Job previously created onto this group.

 

13.jpg

AM Agent on machines with duplicate Hostuuid will execute the Asset job and generate a new Hostuuid.

After some days, the group should be empty.

Additional Information:

Following documents give Additional Information about hostuuid in ITCM.

KB000025648 - How can I find computers whose HostUUID has changed?
https://comm.support.ca.com/kb/how-can-i-find-computers-whose-hostuuid-has-changed/kb000025648

KB000072577: Computer Identification: Everything you need to know about the HostUUID and computer uniqueness in Client Automation.
https://comm.support.ca.com/kb/computer-identification-everything-you-need-to-know/kb000072577