Forum Discussion
Device Bulk Rename Struggle
Another approach would be to run a Detection/Remediation script on the client if the client matches the 10.1* range. If it does, then use the Rename-Computer cmdlet to rename the client, and when the device reboots/shuts, will the name in Intune change? (I've done this in the past and renamed Intune deployed devices to the Asset tag from the bios)
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If one of the posts was helpful in other ways, please consider giving it a Like.
- Jaime_ITJan 04, 2024Brass Contributor
Interesting. Not the Microsoft recommended process, yet it seems completely plausible.
I'll investigate this suggestion and get back to you. Thanks!
- Jan 04, 2024
Let us know! This is what I used to rename the computer based on Asset Tag (replaced value with XXX to avoid mentioning customer name)
if ($env:COMPUTERNAME -notmatch 'XXX') {
if (((Get-WmiObject win32_SystemEnclosure).smbiosassettag -ne $env:COMPUTERNAME)) {
Rename-Computer -NewName ((Get-WmiObject win32_SystemEnclosure).smbiosassettag)
}
}- Jaime_ITJan 06, 2024Brass ContributorSo the issue I run into with this suggestion is that Intune does not natively support device renaming based on specific criteria like IPv4 addresses. I've checked Intune 3x, and unless I'm missing something here or you have another suggestion, I'm back to working on a script. Though I think that I can create a more basic script and deploy it to all devices. Something like this:
$ipAddress = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.IPAddress -like '10.1.*' }).IPAddress
if ($ipAddress -ne $null) {
$serialNumber = (Get-WmiObject Win32_BIOS).SerialNumber
$newComputerName = "A-$serialNumber"
Rename-Computer -NewName $newComputerName -Force -Restart
} else {
Write-Host "IPv4 address does not match the criteria. No action taken."
}
Thoughts?