How do I rename a computer in Active Directory?

To change a computer name, use the Rename-Computer cmdlet. Note that the computer must be online and connected to Active Directory.

For More Information Please Refer: https://blog.netwrix.com/2018/07/10/how-to-create-delete-rename-disable-and-join-computers-in-ad-using-powershell/