In our organisation we were struggling with people sticking to a set of rules for device names e.g.; LT-BLA-01, BLA-LT-01, LT-BLA01 etc etc…
Somehow this was a hard task and and getting an eye soar with all the different variations.
As an MSP it is hard to have a set name with incremental numbers as we also would like the customer’s name in the device name.
Eventually we threw this aside and decided on using the serial number as device name.
Powershell is used to get the serialnumber and system type (laptop or workstation);
$Serial = Get-WMIObject -Class "Win32_BIOS" | Select -Expand SerialNumber function Get-HardwareType { $HardwareType = Get-WmiObject -Class Win32_ComputerSystem -Property PCSystemType if ($HardwareType.PCSystemType -ne '2') { return $true } else { return $false } } if (Get-HardwareType) { Rename-Computer "WS-$($Serial)" } else { Rename-Computer "LT-$($Serial)" }
Save the script to the ScriptRoot “\\MDT\DeploymentShare\Scripts”.
In the MDT Task Sequencer, add a task to run a PowerShell Script.
And add the Powershell script location;
Make sure to add at the script somewhere near the end of the sequence steps, we’ve placed it right before the last restart.
Be First to Comment