Jump to content
DeployCentral

Recommended Posts

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?

For example:

if it was a Lenovo T580 vs an HP 9480m to have one renamed to T580-ABC and the other named 9480-XYZ?

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.

Share this post


Link to post
Share on other sites

If existing name isn't working, try disabling bit-locker or any other encryption and see your results. Usually, that's the case when we see that.

As for your naming convention scenario, that is something that is not implemented into the product.

Thanks,

SmartDeploy Support

Share this post


Link to post
Share on other sites

 

On ‎6‎/‎7‎/‎2018 at 10:49 AM, WM-Martin said:

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?

For example:

if it was a Lenovo T580 vs an HP 9480m to have one renamed to T580-ABC and the other named 9480-XYZ?

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.

You can do this using a VB Script that runs in the postimage sequence. I have something similar set up so I know it can be done.

Share this post


Link to post
Share on other sites
On ‎6‎/‎7‎/‎2018 at 10:49 AM, WM-Martin said:

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?

For example:

if it was a Lenovo T580 vs an HP 9480m to have one renamed to T580-ABC and the other named 9480-XYZ?

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.

wscript.exe T:\RootFolder\ComputerName.vbs

ComputerName.vbs.txt

Share this post


Link to post
Share on other sites

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:

  1. The script is looking for the Model name under Win32_ComputerSystem. This will indeed work for most computers. However, Lenovo does model naming in the system firmware differently than other manufacturers. In that Model field, they put in the the "Machine Type" - something like 20HF###### - and the unique identifier for that model is actually the first four of that machine type. If you're looking for the friendly name for the model, Lenovo puts this into Version under Win32_ComputerSystemProduct (among other places). To behave in a reliable manner, the script would have to be modified with a tree of separate actions for Lenovo products only. 
     
  2. Some model names contain spaces in the last 4 characters. HPs in particular are notorious for this - often incrementing model numbers with generational identifiers such as G1G3, etc. - with a space before this. Adding a space to a computer name is not recommended, so for models which include spaces, it would be preferable to remove these spaces before proceeding. 

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 support@smartdeploy.com, and be sure to reference this thread. 

Glenn 
SmartDeploy Support

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
27 minutes ago, Aaron@Shared said:

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?

You will need to turn on debugging to test and modify how you would like but here is something close to what I use. Rename the attached file to .vbs and test.

GenerateComputerName.vbs.txt

Share this post


Link to post
Share on other sites

Hi Aaron,

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

Feel free to reach out (support@smartdeploy.com) if you have any questions, and be sure to reference the URL of this thread. 

Glenn
SmartDeploy Support
 

Share this post


Link to post
Share on other sites
15 hours ago, SmartDeploySupport said:

Hi Aaron,

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

Feel free to reach out (support@smartdeploy.com) if you have any questions, and be sure to reference the URL of this thread. 

Glenn
SmartDeploy Support
 

Glenn, I cannot download that file. Can you post it via the code syntax?

Like this?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×