- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 02:12 AM
Hi All,
Earlier 'X' windows server was hosted on 'Y' hyper v Host, recently we have migrated and deleted 'X' windows server from 'Y' Hyper V host, now This 'X' windows server is hosted on 'Z' Hyper V host.
1, However when we are are running discovery on 'X' windows server, it has been mapping with current 'Z' Hyper V host and it is removing the relationship between 'X' windows server and old 'Y' Hyper V host(which is working as expected)
2, However after that if we are running discovery on old 'Y' hyper V host, again the relationship is establishing between 'X' windows server and Old 'Y' hyper V host.
could anyone help me why relationship is establishing between 'X' windows server and old 'Y' Hyper V host even after 'X' windows server was deleted from 'Y' hyper V host?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 02:40 AM
Hi @pavan garige ,
Lets understand Why is this happening?
* When you run discovery on the old Hyper-V host 'Y', the Hyper-V discovery pattern uses WMI or Hyper-V APIs to query the list of virtual machines *that the host knows about.
If the deleted VM 'X' still exists in:
* Hyper-V Manager / WMI inventory on 'Y'
* or remains in the host's internal database / as a leftover entry in WMI
then Discovery will see it as an existing VM and recreate the relationship:
* It thinks VM 'X' is still hosted on 'Y' and reestablishes the Hosted on::Hosts relationship between 'X' and 'Y'.
This is because ServiceNow Discovery trusts what the Hyper-V host reports, and if the host still lists the VM, Discovery brings the relationship back.
* How to fix this permanently:
* You need to ensure that the old Hyper-V host 'Y' fully forgets about the deleted VM 'X'.
On Hyper-V host 'Y':
1. Open Hyper-V Manager → confirm VM 'X' no longer appears (even as 'Off' or 'Saved').
2.Open Failover Cluster Manager (if applicable) → confirm no stale cluster resource for VM 'X'.
3.Remove any leftover VM configuration files (.xml / .vmcx / .vhdx) from the filesystem.
4.Use Hyper-V WMI tools / PowerShell:
Get-VM -Name "X"
→ If it still shows, use:
Remove-VM -Name "X" -Force
Clear any leftover checkpoints or saved states.
ServiceNow side:
* After cleaning the Hyper-V host:
* Run discovery on 'Y' Hyper-V host → confirm that the VM 'X' no longer shows.
* Then run discovery on 'Z' Hyper-V host → ensure correct relationship is kept.
* You can also manually delete any invalid relationships from the CMDB if they keep coming back, after fixing at the source.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 02:40 AM
Hi @pavan garige ,
Lets understand Why is this happening?
* When you run discovery on the old Hyper-V host 'Y', the Hyper-V discovery pattern uses WMI or Hyper-V APIs to query the list of virtual machines *that the host knows about.
If the deleted VM 'X' still exists in:
* Hyper-V Manager / WMI inventory on 'Y'
* or remains in the host's internal database / as a leftover entry in WMI
then Discovery will see it as an existing VM and recreate the relationship:
* It thinks VM 'X' is still hosted on 'Y' and reestablishes the Hosted on::Hosts relationship between 'X' and 'Y'.
This is because ServiceNow Discovery trusts what the Hyper-V host reports, and if the host still lists the VM, Discovery brings the relationship back.
* How to fix this permanently:
* You need to ensure that the old Hyper-V host 'Y' fully forgets about the deleted VM 'X'.
On Hyper-V host 'Y':
1. Open Hyper-V Manager → confirm VM 'X' no longer appears (even as 'Off' or 'Saved').
2.Open Failover Cluster Manager (if applicable) → confirm no stale cluster resource for VM 'X'.
3.Remove any leftover VM configuration files (.xml / .vmcx / .vhdx) from the filesystem.
4.Use Hyper-V WMI tools / PowerShell:
Get-VM -Name "X"
→ If it still shows, use:
Remove-VM -Name "X" -Force
Clear any leftover checkpoints or saved states.
ServiceNow side:
* After cleaning the Hyper-V host:
* Run discovery on 'Y' Hyper-V host → confirm that the VM 'X' no longer shows.
* Then run discovery on 'Z' Hyper-V host → ensure correct relationship is kept.
* You can also manually delete any invalid relationships from the CMDB if they keep coming back, after fixing at the source.
Please appreciate the efforts of community contributors by marking appropriate response as Mark my Answer Helpful or Accept Solution this may help other community users to follow correct solution in future.
Thank You
AJ - TechTrek with AJ - ITOM Trainer
LinkedIn:- https://www.linkedin.com/in/ajay-kumar-66a91385/
YouTube:- https://www.youtube.com/@learnitomwithaj
Topmate:- https://topmate.io/aj_techtrekwithaj (Connect for 1-1 Session)
ServiceNow Community MVP 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 07:23 AM
HI AJ,
Thanks for the detailed explanation, The X windows server has been powered off on 'Y' hyper V host, However they have not removed/deleted 'X' server from 'Y' Hyper V host(it was showed in Old Hyper V console).
now once after removing from 'Y' Hyper V host, now the relationship has been removed between 'X' windows server and 'Y' Hyper V host and it is working as expected.
Thanks,
Pavan Garige
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2025 07:25 AM