@Ahmed Alshatawi •, Thanks for posting in Q&A. Based on my researching, there is no related policy in Intune can prevent users from changing hostnames on windows. when it is admin
Also, just as Rahul mentioned the rename action changes the device name that the user can see in the Company Portal. It does not change the local device name, only the name in the Company Portal. Therefore, it will not rename the device in the Intune portal.
For your scenario, I have an idea. We can use remediation script, detect the device which the name is not met and rename it via script.
https://learn.microsoft.com/en-us/mem/intune/fundamentals/remediations
Hope the above information can help.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.