I'm currently creating a PowerShell script who need to be able to rename computer name:
Write-Host "Enter the new computer name: " -NoNewline
$name = Read-Host
Rename-Computer -NewName $name
And when I execute this code I got this error, even if I start the script with Administrator rights, I get the same error.
Rename-Computer : The computer "LAPTOP-ASVDNCPD" could not be renamed to "[new_computer_name]" because of the following exception: Access Denied.