Hi, I'd be happy to help you out with your question. Sorry for the inconvenience caused. It's possible that you're encountering a permissions issue when running the command from Intune. To resolve this, you may need to ensure that the account running the Rename-Computer command has the necessary permissions to rename the computer. You can do this by adding the account to the local administrators group on the target computer. Another option is to run the script locally on the target computer instead of pushing it from Intune. This can help ensure that any permission issues are resolved before attempting to run the script remotely. If you need to run the script from Intune, you can try wrapping the Rename-Computer command in a PowerShell script that elevates the execution level to administrator using the Start-Process cmdlet with the -Verb RunAs option. However, it's important to remember that renaming a computer after it has been provisioned can cause issues with applications and services that rely on the computer name. So be sure to thoroughly test any changes before deploying them to production. If you're still having trouble renaming the computer, there are third-party tools and scripts available that can help. For example, you might try the Rename-Computer tool from Sysinternals or the PowerShell script available on the Microsoft TechNet Gallery. Here's an example PowerShell script that renames the computer based on the serial number: $serialNumber = (Get-WmiObject Win32_BIOS).SerialNumber $computerName = "MyComputer-$serialNumber" Rename-Computer -NewName $computerName -Force -Restart This script gets the serial number of the computer using the Get-WmiObject cmdlet and then appends it to the desired computer name. It then uses the Rename-Computer cmdlet to rename the computer and restart it. Note that the -Force parameter is used to suppress confirmation prompts, and the -Restart parameter is used to restart the computer after renaming it. If you have any other questions or need assistance with anything, please don't hesitate to let me know. I'm here to help.
If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.