Searching for a computer name in Resource Manager does not show the expected results. This happens on computers that were reimaged or renamed a while back.
In this example, the new name should be BHEMXL5190QKK, however it also shows the old machine name BHEB1128E in some areas of Resource Manager:
NA
ITMS 7.0, 7.1, 7.5, 7.6, 8.1 RU6
The data in different tables that represents the name does not match although the GUIDs do.
The query below can be used to first determine if the problem exists.
select
s.String 'String Table'
,c.Name 'RM_Computer\Virtual Machine'
,ident.Name 'Inv_Aex_AC_Identification'
from vRM_Computer_Item c
left join Inv_AeX_AC_Identification ident on ident._ResourceGuid = c.Guid
join String s on s.BaseGuid = c.Guid
and StringRef = 'item.name' and Culture = ''
where s.String <> c.Name
This query can be used to update the String and Inv_AeX_AC_Identification tables to match the assumed correct table of RM_ResourceComputer and RM_ResourceVirtual_Machine
--Update the String table to match the RM_ table
update String
set String = c.Name
from vRM_Computer_Item c
where c.Guid in
(
select vc.Guid
from vRM_Computer_Item vc
left join String s on s.BaseGuid = vc.Guid
and s.StringRef = 'item.Name'
where (s.String <> vc.Name or s.String is null)
and vc.Name <> ''
)
and BaseGuid = c.Guid
and StringRef = 'item.Name'
--Put data into string if it does not exist
insert into String
select
NEWID ()
,vc.Guid, 'item.name'
,''
,vc.Name
,GETDATE ()
,GETDATE ()
from vRM_Computer_Item vc
left join String s on s.BaseGuid = vc.Guid
and s.StringRef = 'item.Name'
where s.String is null
NOTE:
The following queries can be used to troubleshoot this issue if the ones above didn't show the mismatch or if the issue is only in the String table:
--Find machines with name mismatch
select c.Guid, c.Name, s.String, c.CreatedDate
from vRM_Computer_Item c
join string s on s.BaseGuid = c.Guid
and s.StringRef = 'item.name'
where s.String <> c.Name
--Fix: Sync names
Declare @t as table (Guid uniqueidentifier, Name nvarchar (1000))
insert into @t
select c.guid, c.name--, s.string, c.createddate
from vRM_Computer_Item c
join string s on s.baseguid = c.guid
and s.stringref = 'item.name'
where s.string <> c.name
update String
set string = t.name
from @t t
where t.guid = string.baseguid
and string.stringref = 'item.name'
--and t.guid = 'GUID' --Add computer GUID here if you only want to do one computer at the time