PS Script to rename computer based on current logged in user and device type
Can someone please help with the powershell script for changing the computer name based on current logged in user and device type.
PS: We don't have AD/DC - nothing on prem. All standalone PC's connected to AzureAD. So we will push this script down to the machine using the our MDM tool.
If the current logged in user on the PC is AzureAD\JohnSmith and Device Type is a Laptop, then the computer should be renamed as JohnSmith-L
Basically just get the parts in bold above and concatenate them and then set it as the computer name.
I've got a few bits together for getting the Name and Device Type. Just cant get my head around how to set the name as desired.
Open in new windowWhat do you want for device type, the chassis?