HexCon is coming to NYC. Catch the early-bird price before the time's up! Book me a spot

How to change the device’s Bluetooth name remotelySolved

Participant
Discussion
5 months ago

Hi @everyone

Does anyone have an idea about this?

I need to change the Bluetooth name on Windows and macOS devices remotely from the UEM portal. Are there any methods or suggestions available?

Replies (3)

Marked SolutionPending Review
Participant
5 months ago
Marked SolutionPending Review

Hi @eugene  Yes, you can execute the script remotely on UEM enrolled Windows devices.

PowerShell script to change the Bluetooth name:

$newName = "NewDeviceName" # Replace with new device name
Rename-Computer -NewName $newName

This script changes the device name, which accordingly changes the Bluetooth name.

After executing the script, it is necessary to restart the device. The changes will take effect only after restarting the device.

Marked SolutionPending Review
Participant
5 months ago
Marked SolutionPending Review

Hey @eugene
It’s not possible to directly change the Bluetooth name on any device. You can change the Bluetooth name by changing the device name.

Try this script to change the device and Bluetooth name on macOS.

#!/bin/bash
sudo scutil --set ComputerName "NewDeviceName"

Save this script in .sh file format and execute using the Execute Custom Script action.

Marked SolutionPending Review
Hexnode Expert
5 months ago
Marked SolutionPending Review

Hi @eugene Thanks for reaching out to Hexnode Connect!

Yes, you can use scripts to modify the device name which ultimately changes the Bluetooth name.

Script to change the device name and Bluetooth name on macOS

You can execute the following script to change the Bluetooth name on macOS via Hexnode’s Execute Custom Script feature.

#!/bin/bash
newdevicename="NewDeviceName"
sudo scutil --set ComputerName "$newdevicename"
echo "Device and Bluetooth name changed to $newdevicename"

In the above-mentioned bash script, replace “NewDeviceName” with the desired name you wish to set as the device name or Bluetooth name.

After executing the script, the device and Bluetooth name will be changed on the device’s end. You can check the script’s output from the Action History tab.

Script to change the device name and Bluetooth name on Windows

To change the Bluetooth name on Windows devices via Hexnode’s Execute Custom Script feature, execute the following PowerShell script.

param(
[string] $deviceName
)
try{
if($deviceName)
{
Write-Host "Changing device name to:"$deviceName
Rename-Computer -NewName $deviceName
}
else
{
Write-Host "Please provide device name as argument"
}
}
catch
{
Write-Host $_.Exception.Message
}

While executing the script, you need to pass the desired device name that you wish to set on the device in the Arguments field. Utilize the wildcards supported by Hexnode to pass the Arguments, enabling you to execute the script on multiple devices simultaneously.

After executing the script, execute the “Restart Device” action to reflect the changes on the device’s end.

I hope this helps. Feel free to contact us at any time if you have any further queries or concerns.

Regards,

Daniel Mark

Hexnode UEM