Hi ,
Thank you for posting the query on Microsoft Community.
I understand your concern and will assist you to resolve this issue. You can the below powershell commands for renaming the computer as per your requirement.
$serial = Get-PhysicalDisk | Select-Object SerialNumber
$newname = $Serial.Substring(3,5)
Rename-Computer -NewName $newname -Force -Restart
Note: I took number from 3 to 5 in my example. In case if you have 15 or more than numbers, you can run , you can modify the commands as per your requirement. In below example i have 15 and took numbers from 11 to 15.
$newname = $Serial.Substring(11,15)
--please don't forget to upvote and Accept as answer if the reply is helpful--