Just recently had to do this with my own work machine. I was working through some problem machines and realized my own device was no longer showing in intune even though dsregcmd shows as being managed.
+----------------------------------------------------------------------+
| Diagnostic Data |
+----------------------------------------------------------------------+
AadRecoveryEnabled : NO
Executing Account Name : ------------------, ---------------------
KeySignTest : PASSED
DisplayNameUpdated : Managed by MDM
OsVersionUpdated : Managed by MDM
HostNameUpdated : YES
Last HostName Update : SUCCESS
Client Time : 2023-09-20 20:20:40.000 UTC
Request ID : d878f7db-09a1-43cf-84d8-6055dde8d478
Server Time : 09-20-2023 20:20:41Z
HTTP Status : 200
Server Message : The attribute 'hostnames' value(s) were successfully updated