Jump to content

Passing variables in sif file


Recommended Posts

Hi Everyone,

I have a small problem that someone may be able to help me with. Where I work we like to set the "Computer Description" field to display the asset tag (a label we affix) of the PC.

Currently our build process is RIS/SMS-based and fully automated. The *only* reason we need to log onto a PC before it is deployed to a staff desk is to set the above field.

I am able to create a custom osc file for RIS that allows me to create the variable %ASSET%. Unfortunately, I can't then find a way to add that variable as a REG_SZ vlaue to the registry key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters\srvcomment

Initially I tried running a REG command through GUIRunOnce, but of course, after the first reboot the %ASSET% variable will be lost.

I then decided to write the variable to a .reg file that I could then import via REGEDIT /S. However, I do not know how to achieve this within the sif file.

If anyone knows how to go about doing this, or has a better idea I've not thought of, I'd be very grateful if they let me know.

Thanks,

Andy

Link to comment
Share on other sites


Lo dude..

@ my place we are using RIS as well to deploy installations to servers & clients. to be able to automate the installation for naming purposes of the computers, we need to save a variable with the information from the custom .osc file @ boot time to the installation sequence.

This is very much alike what u want do if i understand u correctly, u just wanna have the description entered @ the .osc and then populated to the comp object once the installation is done... or?

in that case maby our solution would work for ya. RIS creates a temp object for the installation of the client, the .osc file will then place the value of the screen (.osc) by means of a .vbs script, into an empty "trash" attribute of the temp object. Once u r in Win32 mode, another .vbs is executed from the [GuiRunOnce] section that will find the object in Active Directory (and read) the trash attribute. This way the value will be known and can be copied / deleted & modified any way u want to another attribute (description) for example.

hope this gives u a possible way to go forward.

good luck and stuff..

over & out from the sasusage eater!

Link to comment
Share on other sites

Another possibility would be using a DOS based utility from someone like Dell. I used to have this thing, but now I have to find it again. Essentially the utility reads the Dell service tag and put into a variable. I remember reading about one such procedure right here on MSFN, where the utility was run from PRESETUP.CMD as a part of a Method 2 BTS install.

EDIT: Another possibility would be to do this all through scripting after the install is complete (like during RunOnceEx). You can easily enumerate all of the BIOS strings using WMI in VBscript and then insert whatever value into the registry. If you want assistance with this, let me know. It shouldn't be much at all to get the value from WMI. Very similar to my routine of determining the chassis type.

Edited by RogueSpear
Link to comment
Share on other sites

Thanks Dave. Any ideas you have would be appreciated.

I don't know whether you missed where I mentioned that the asset tag in question is a label, and not a BIOS value? As such, it cannot be entered by using WMI to query a system value. It needs to be entered via a custom RIS osc file. From there stems my problem.

Thanks,

Andy

Link to comment
Share on other sites

I don't want to sound as though I'm telling you that you haven't done your homework because I'm not (sometimes the typed word can easily be misread), but I'm just wondering if you've done a scan of all the BIOS values with WMI or something like SiSoft Sandra. I know that a lot of the "generics" don't populate the BIOS with any useful information at all, but I think all of the biggies do (Dell, HP, Gateway, etc).

Also, if there isn't anything in there, would it feasable for you to make a table where these tags match up to a MAC address? This way you could use a what might be a lengthy CASE/SELECT statement in VB. If your workstations number in the hundreds it could be better to make a CSV file and read from that.

Lastly, if you are prestaging your RIS workstations, say to a particular OU, you can prepopulate the description field from within dsa.msc. I hope some of this helps.

Link to comment
Share on other sites

Hi Dave,

No problem :P. I know that the value I need doesn't exist in the BIOS because of a couple of reasons:

1. We affix an asset tag sticker to every unit we get in. It consists of a 5 digit number that is sequential and in no way related to any aspect of the PC. This is the number I need to manually enter at build time.

2. We generally use PCs by a UK OEM called "RM (Research Machines)". They supply a lot of units specifically to HE/Schools/etc. and do not deal in the private sector. We chose them because of the good discount through bulk purchase that they offer, the quality of their product and most importantly because they give great next day on-site support for hardware. We've been burned in the past by other companies *terrible* support - specifically Dell. They currently supply us with units based on the Intel 915GUX platform.

We do use the MAC address to create the host name automaticallly. This makes it possible for us to pre-stage AD accounts via RIS - and indeed we do this so that OU selection occurs during RIS menu selection.

Now, I agree that basing the asset tag on the MAC address makes a lot of sense because it allows for a lot of automation. Unfortunately, the management don't necessarily share this vierw and (currently at least) we're stuck with labels.

Your idea about an asset tag - MAC address table is interesting. Our management are always trying to push the idea of an "Asset Register" that lists all PC details (inc. MAC address) against the asset tag we affix. Unfortunately, even though this is a good idea, it never seems to get off of the ground for a few reasons beyond our control (mostly politics). We have migrated to SMS in the last 18 months and are currently making a new effort to compile an accurate list from WMI queries, but I'm not holding my breath. For reference, we have ~ 2000 desktops to manage.

So, now I hope it's a little clearer why I (possibly) need to go through the ordeal of passing variables, creating files, etc rather than simply reading values from memory through WMI.

If you have any other suggestions please let me know.

Cheers,

Andy

Edited by Fencer128
Link to comment
Share on other sites

Well if somebody decided to make an asset number by hand, then I guess you're going to have to get creative. I've seen it before myself, politics has a way of defeating every technological stride made in the last decade. I feel your pain friend. I work in goverment myself and after 11 years I'm still shaking my head in disbelief.

Link to comment
Share on other sites

Well, it looks as if I might be able to pursue the idea of reading the asset tag from a pre-populated table.

Our suppliers send us a list of MAC addresses with every order. We can create a table from this and assign sequential asset tag numbers to it. After build we can then run a VBS file from GUIRunOnce to read the value from the table and populate the computer description. All we then have to do manually is to stick the correct label on. It does depend on us keeping an accurate list someweher, but you can't have everything!

Thanks,

Andy

Edited by Fencer128
Link to comment
Share on other sites

In Active Directory Users and Computers (dsa.msc), in the properties of a Computer, there is a field for description. This field does not actually correspond to the description field in the properties of My Computer, which is something I could never understand anyway. But, going on the assumption that you are prestaging your computers in their appropriate OUs, the prestaging process is probably fairly labor intense to begin with (if you have ~2000 units).

Using ADSI within a VBS, you could script the prestaging of your computers and include the asset tag in this process, putting it in the description field. Then your post setup script, if you even decide you'd need it at this point, would only have to query ADSI for the Active Directory description of the computer and place it in the registry entry that populates the description field from My Computer.

This way you'd get the best of both worlds. You would cut down your prestaging labor, and get the asset tag in both description fields.

Link to comment
Share on other sites

Hi Dave,

I like the idea of populating both fields - as opposed to just the registry key for the local PC.

EDIT: [ We currently pre-stage our accounts by selecting an OU from a drop-down list at build time in the RIS menu.]

I'm actually talking rubbish here :blushing: We don't pre-stage the accounts at all! So, doing it from our asset register aseems like a good idea (see below). It's amazing how if you check first-hand, you often find that what people had told you they *thought* was true, was actually completely the opposite!

Now, as you suggest (I think!) we could run a script on the information we've recieved from our suppliers to pre-stage all of the accounts at once, and then build the PCs via RIS without creating the accounts. I'll need to look into how this will affect our distribution process - Thanks for the idea though.

One other thing to mention is that we've now decided to bar code our asset tags. What I've proposed is to pre-populate a table with the MAC address and OEM serial numbers of the PCs. When the units are unpacked asset labels will be attached and the asset number and OEM serial number will be scanned via bar code reader. This will create an entry in the table for the asset number next to the corresponding OEM serial number (and hence MAC address).

At build time the GUIRunOnce section will run a VBS to read the asset tag value from the table (stored in an accessible network share) that is held against it's MAC address, and create the necessary registry entry to populate the "Computer Description" field.

This way we can use our sequential asset labels out of sequence if need be as the asset number is only assigned to the PCs serial number/MAC address at the time at which we stick on the label and scan the codes.

I hope that makes sense!

Cheers again,

Andy

Edited by Fencer128
Link to comment
Share on other sites

In Active Directory Users and Computers (dsa.msc), in the properties of a Computer, there is a field for description. This field does not actually correspond to the description field in the properties of My Computer, which is something I could never understand anyway. But, going on the assumption that you are prestaging your computers in their appropriate OUs, the prestaging process is probably fairly labor intense to begin with (if you have ~2000 units).

Using ADSI within a VBS, you could script the prestaging of your computers and include the asset tag in this process, putting it in the description field. Then your post setup script, if you even decide you'd need it at this point, would only have to query ADSI for the Active Directory description of the computer and place it in the registry entry that populates the description field from My Computer.

This way you'd get the best of both worlds. You would cut down your prestaging labor, and get the asset tag in both description fields.

Nice one... :)

Link to comment
Share on other sites

  • 2 weeks later...

It is fairly easy to do what you want to do, but it's not entirely obvious. I do something similar to what you are attempting to do, and after lots of crawling the newsgroups and poking and prodding test setups, I've found a way to make this work. Try the following:

In the [GuiRunOnce] section, call a batch file and pass it the %ASSET% variable in the command line of the batch file, like so:

[GuiRunOnce]

Command0 = "c:\windows\temp\asset.cmd %ASSET%"

Your "asset.cmd" file should do something like this:

echo %1 > c:\windows\temp\asset.txt

The OSC variables are still available at this point, so this should work, and your variable should survive (via the text file) into Windows post-setup.

Using a batch file or a vbscript, you could do something based on the contents of that text file, like add it to the registry (either a reg add statement from a batch or objReg.SetStringValue from a vbs).

Link to comment
Share on other sites

@cluberti, you've been a member here for over four years and this was your first post? Well from that first post it seems like you could really offer a lot around here. I'm hoping to test out your solution sometime in the next couple of weeks. Excellent suggestion.

Oh and another thing.. keep 'em coming :thumbup

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...