Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

%computername% wildcards

Updated: 21 Nov 2010 | 5 comments
Injector's picture
0 0 Votes
Login to vote
This issue has been solved. See solution.

 

I'm trying to create a script that will output the last 5 digits of the computer name and set them as the asset tag of the computer, so far i have this

Echo %computername% >> tag.txt // outputs the computer name (SEL-45675) to a text file named tag.txt

biosconfigutility.exe /setconfig:tag.txt // uses the hp utility to load the configuration from the tag.txt file.

My issue is that the tag can't have the first 4 characters, so i need to supress the SEL- part from the tag.txt file

 

i know that "%Compuername:~0,5%" will make the out be only the first 5 characters which is the opposite of what i'm trying to do.

Comments

Injector's picture
21
Nov
2010
3 Votes +3
Login to vote

I figured it out   echo

I figured it out

 

echo %computername:~-5%

pashyn's picture
24
Nov
2010
0 Votes 0
Login to vote

Thanks!

Thanks for sharing solution. This is really usefull info!

Injector's picture
25
Nov
2010
1 Vote +1
Login to vote

NP, i also figured out a

NP, i also figured out a couple others that can help out everyone like

 

Echo %computername:~4,3%  - this will go to the fourth character and echo out the next 3 characters 

Example with computer name being SEL-123LT:

Echo %computername:~4,3% - this will echo 123

carlsson's picture
25
Nov
2010
0 Votes 0
Login to vote

bios

are you doing this through DS with HP pack installed?

I cant seem to find the biosconfigutility ??

 sorry found it .

it comes with the SSM download from HP :)

C

Hojiblanca

Injector's picture
26
Nov
2010
0 Votes 0
Login to vote

I'm doing it through a script

I'm doing it through a script loaded in the image before deploying, but as long as all your computers are named already yes you can use DS to execute it. and yes it's part of the SSM. one thing you'll want to keep in mind is that the tag file will need to have some text in it before you echo the tag into it or the HP utility will not read it correctly, it should look like this

 

 

English
 
Asset Tracking Number
   <Tab space>     SEL-#####
 
the important part is to make sure that the last line of the file ends after a space made with the tab key, this way when the name gets inserted into the file it goes in the right spot for the HP utility to catch it. if you have any more bios settings you would like to change make sure they are written above the asset tag and under english. i can attach my pre-formatted file if you like.