(Redirecting to the unattended-info mailing list, since others may
well have the same question.)

"Andy Lyne" <[EMAIL PROTECTED]> writes:

> I am trying to create a fully unattended installation of XP
> professional, including all required applications, installed from a
> bootable CD.  The problem is that if I don't use a cd provided by
> volume licencing, I need to put in a unique Product id in the
> Winnt.sif for each installation. Also, some of my installations are
> on pc's not directly connected to the internet, so the
> AutoActivate=Yes option wouldn't really help anyway.
> 
> My question is, are there any lines I can put in the winnt.sif that
> will bypass activation at this initial stage of installation, so my
> unattended install will continue uninterrupted. I can then activate
> XP post install.
> 
> What I really need is an AutoActivate=Skip. :)

Activation is a separate step from OS installation.  Installation
requires a license key, whether you activate then or not.  All
"AutoActivate=Yes" does is tell Windows Setup to activate the OS
during installation.

I am having the same problem; my company is buying laptops with OEM XP
licenses, each one has a different key, and we have no volume license.
This weekend, though, I got something cool working.  Well, I think
it's cool.  I edited our z:\site\config.pl to ask for a company asset
tag number during installation, then to parse our hardware and
software inventory spreadsheets (CSV files) to find the host name and
license key associated with that asset tag.

I *really* need to document this sort of advanced functionality, but I
keep failing to find the time.  But just to give you an idea, I am
appending our z:\site\config.pl file to this message.  Recall that
config.pl is read by install.pl, which is the Perl script run by the
boot disk from DOS.  Also, note that z:\site\hardware.csv and
z:\site\software.csv are symlinks to our spreadsheets listing the
systems and licenses (respectively) which we have.

The supporting file is doslib/csv.pl, which I am bundling with the
next release of Unattended; it is a parser for comma-separated-value
spreadsheets.  You can browse it here:

  
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/unattended/unattended/install/doslib/csv.pl?rev=HEAD&content-type=text/vnd.viewcvs-markup

I hope the comments explain things well enough.

I am debating with myself whether to write more documentation or just
to make a release.  I wish writing took less time.

 - Pat


use warnings;
use strict;
use Carp;

# Look up an entry in a hash, bombing out if it does not exist.
sub hash_ref ($$) {
    my ($hash, $key) = @_;

    my $type = ref $hash;
    $type eq 'HASH'
        or croak "You blew it: What should be a hash is a $type";

    (exists $hash->{$key})
        or croak "$key not found in hash -- bailing out";
    return $hash->{$key};
}

# Asset tag stuff
require 'csv.pl';

# Routine to canonicalize field names for indexing purposes.
sub canonicalize_field ($) {
    my ($val) = @_;
    # Convert to lower case.
    $val = lc $val;
    # Local custom: Comments may appear in parens.  Strip them.
    $val =~ s/\s*\(.*?\)//g;
    return $val;
}

# Read hardware inventory list, and index it by tag.
my $hard_inv = 'z:\\site\\hardware.csv';
my $hardware = CSV->read_file ($hard_inv);
my $hard_by_tag = $hardware->index_by ('Asset', \&canonicalize_field);

# Read software inventory list, and index it by owner (hardware tag).
my $soft_inv = 'z:\\site\\software.csv';
my $software = CSV->read_file ($soft_inv);
my $soft_by_owner = $software->index_by ('Owner', \&canonicalize_field);

# Create new [_meta]/asset_tag attribute.
set_value ('_meta', 'asset_tag',
           sub {
               my $ret = simple_q ('Enter asset tag (default = none): ');
               defined $ret
                   or print "OK, have it your way.\n";
               return lc $ret;
           });

# Compute computer name from inventory sheet, if possible.
sub computer_name {
    my $tag = get_value ('_meta', 'asset_tag');
    defined $tag
        or return undef;
    my @systems = @{$hard_by_tag->{$tag}};
    scalar @systems == 0
        and die "Tag $tag not found in $hard_inv -- bailing";
    scalar @systems > 1
        and die "Tag $tag found more than once in $hard_inv -- bailing";
    my $name = hash_ref ($systems[0], 'Name');
    $name =~ /\S/
        or undef $name;
    my $text = (defined $name
                ? "Found hostname for tag $tag: $name\n"
                : "No hostname found for tag $tag in $hard_inv\n");
    print $text;
    return $name;
}

push_value ('UserData', 'ComputerName', \&computer_name);

# Compute product key from inventory sheet, if possible.
sub product_key {
    my $tag = get_value ('_meta', 'asset_tag');
    defined $tag
        or return undef;
    my @licenses = @{$soft_by_owner->{$tag}};
    my $key;
    foreach my $license (@licenses) {
        my $desc = hash_ref ($license, 'Description');
        $desc =~ /^Microsoft Windows/
            or next;
        $key = hash_ref ($license, 'Key');
        $key =~ /\S/
            and last;
        undef $key;
    }

    my $text = (defined $key
                ? "Found product key for tag $tag: $key\n"
                : "No product key found for tag $tag in $soft_inv\n");
    print $text;

    return $key;
}

push_value ('UserData', 'ProductKey', \&product_key);




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
unattended-info mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unattended-info

Reply via email to