Is there a way to configure the device renaming process to use the default WMI query of the serial name, but to cut it down to something like the last 4 digits and then include a prefix dependent on the machine type?
Hopefully someone can help me out with this. Its not the end of the world, but because of this we aren't using the automatic domain join feature currently. Also I'm not sure, but I don't think the "use existing" name is currently working for us. I will try to test a bit more, but that would certainly help us with existing machines.
I created a script for you. You'll have to modify to your liking. Add a PostImage task in SmartDeploy pointing to this file. It needs to be part of your file system when you capture the image. The script I use is in a folder in the root of the C: drive on my image. The task will need to look like below.
Hi Martin & Ray,
I thought I'd chime in here - looking at Ray's script, it does appear that - with some modifications (as the script is currently in debugging mode and merely echoes the modified computer name back to the console, rather than updating the UnattendXML files), it would do something close to what Martin is asking for.
Although I did notice one possible error - the parsed versions of the serial number and model (respectively) use a Left([serial number or model], 4) command, which would return the first four digits of the item requested, not the last 4. Switching this for a Right (item, 4) command would fix this issue, but could introduce some additional complexity.
Unfortunately, even with the fixes above added, there are two potential issues with the script as written:
It is possible to design a script with a branching series of if/then/else statements that accounts for all of these possibilities, but it would necessarily be specific to the hardware in your individual environment, require testing on multiple units of that hardware to ensure that it behaves consistently, and it could likely need to be updated to account for the variations of every new model that is added to your environment. For this reason, we generally do not recommend such a potentially cumbersome approach. We have had users set up more basic versions of what you're asking for - grabbing the last 4 or 5 digits of the serial number, and appending this to an identifier prefix which corresponds to the location or role that the computer will be utilized in - something like LAB-12345 or NYC-54321. This is a pretty reliable naming convention, since nearly every device will have a serial number (unless it has had its system board replaced), and the prefix is not hardware-dependent or variable.
If either of you have any questions on this, please feel free to reach out at sup...@smartdeploy.com, and be sure to reference this thread.
Glenn
SmartDeploy Support
I agree with Glen and found the same things in my Lenovo Machine. I only generated that just to give a baseline as to how it could be done. Although it is possible, it would get very difficult to maintain with so many different models getting added all of the time. A generic approach would be a bit better to use.
Could someone create a script for this purpose and post it here? I need a script to be able to grab the last 7 of the serial number and put either an HPC or HPL in front of it for the PCID. Can a script be created to determine if desktop or laptop and then pull the last 7 from BIOS?
Sure thing - here you go.
There are comments in the script to indicate where to change the prefix (currently "PRE-"), as well as the number of characters you want from the serial number. Note that Dell devices use only 7 characters in the serial number ("Service Tag", they call it - but it's the same WMI field) - that's the shortest standard that I'm aware of, but it would probably be safest to go with something shorter, like the last 5 characters.
GenerateCompName-PrefixplusLast7SerialNumber.txt
Sure thing - here you go.
There are comments in the script to indicate where to change the prefix (currently "PRE-"), as well as the number of characters you want from the serial number. Note that Dell devices use only 7 characters in the serial number ("Service Tag", they call it - but it's the same WMI field) - that's the shortest standard that I'm aware of, but it would probably be safest to go with something shorter, like the last 5 characters.
GenerateCompName-PrefixplusLast7SerialNumber.txt
We customize our system names using the asset tag information that we assign to the machine. Years ago I found a utility online called wsname. I use a text file and input the serial number from the machine and assign the asset tag number there. When I run the batch file as a post deployment task, it renames the machine after it's already joined our domain. There are several options to use with this tool, but this is what works best for us. You can find the download online by searching for wsname. It's a free tool ... hasn't been updated in a very long time, but it still works with Windows 10.
Hi all,
If anyone reading this needs assistance scripting a custom computer name, please reach out to sup...@smartdeploy.com and we'll be happy to assist. Its feasibility depends on your specific scenario, but we'll be happy to assist if we can.
Glenn
SmartDeploy Support