Jump to content

Multiple PC Configurations


Recommended Posts

Hey guys. I'm wondering if this is possible....

I have 2 computers which the unattended CD will be installed on. Is there a way to have a separate profile for each PC? By profile, I mean a list of installed applications, registry tweaks and program registrations.

For example, I have a GF4 MX440 and I install the ForceWare drivers. The other PC has a Matrox G400. In my registry files I enable CoolBits. Now, as you can tell, I don't need the CoolBits part for the second PC.

Another example, I want to install Serious Samurize on one PC but not another. Is this possible?

One last example is a registry file for registering mIRC. Now, both computers have different registrations, how can I import only the registration I need.

These profiles should be based on the username ("RaveRod" and "MissCath"). I'm going to convert all my batch and registry files to INF soon so if there was a way to do this, I would be grateful.

One idea was if it was possible to read a registry key into a variable during INF processing. I don't know how to do this though (gosh?? :)).

Thanks in advance.

Link to comment
Share on other sites


I've figured it out (kinda).

During cmdlines, I have a .cmd file that asks for an alternate administrator name (eg. "RaveRod" or "MissCath"), then I have ANOTHER .cmd file that adds the RunOnceEx commnds to the registry.

If I combine both of those .cmd files, I can use the "NewAdmin" variable I set to determine if I need to run each reg command to add the RunOnceEx method.

I don't know if I can move to a total INF format but this is close enough.

Still need to work out the registry files though... at the moment I have a regedits.cmd file that gets run at RunOnceEx to load my registry edits.

for %%i in (%systemdrive%\MSA\registry\*.reg) do start /wait regedit /s %%i

I guess the best idea would be to put all common registry edits in this folder and then make 2 more dirs, "rave" and "miss" and put specific regedits in there, make 2 more regedits.cmd files and just change the paths....

**** I'm smart! :)

Link to comment
Share on other sites

I used to do someting similar, in that I would generate a .REG file, and then import with REGEDIT /S. It allows adding logic (IF ... THEN), as well as the ability to import registry settings from variables, something a static .REG file cannot do.

Now I use REG.EXE in my batch files instead, with the disadvantage that it seems to be quite a bit slower, as it calls the program once per registry entry, as opposed to the "all at once" REGEDIT method.

Just a couple alternatives to consider ...

Link to comment
Share on other sites

Guest zippy

I made two cmd batch, one runs from DetachedProgram asking every needed information and adding to HKCU\Environment, the other is called by cmdlines.txt doing the real job.

The 2nd cmd batch came from GreenMachine's MAKEUSER.CMD, and add some extra logic control.

#1 kill 1st cmd batch window if it still exists.

#2 apply basic/extra regTweak from the answer in HKCU\Environment

#3 retrieve user list from the answer in HKCU\Environment or Reistered Owner.

#4 clean up HKCU\Environment

So, I can have unattended setup, when T-12 my default settings applies.

Or, operates interactively with questions/answers, then extra setting applies.

Link to comment
Share on other sites

Hey guys. I'm wondering if this is possible....

I have 2 computers which the unattended CD will be installed on. Is there a way to have a separate profile for each PC? By profile, I mean a list of installed applications, registry tweaks and program registrations.

I was thinking of doing this too... My Primary PC (built on Asus P4P800DLX) uses a VIA raid controller, and my 2nd PC (built on Asus P4PE) uses a Promise raid controller. My 3rd PC (built on Abit BX6 r2) and my Laptop (Thinkpad T23) do not have either raid controller so they do not need either VIA or Promise utility.

So on the P4P800 machine I want to install the VIA Raid Tool, and on the P4PE machine I want to install the Promise Array Manager. But on the other two, I don't want anything installed.

If WMI is up.. this is a VB script reads the Product Name from the SMBIOS Info and displays it in a message box on the screen...

-----------------------------------------------------------

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set objWMI_Mboards = objWMIService.ExecQuery _

("Select * from Win32_BaseBoard")

For Each objWMIMboard In objWMI_Mboards

Wscript.Echo "Product = " & objWMIMboard.Product

next

-----------------------------------------------------------

When run after WinXP Pro has been completely installed on ___ message shows ____

Asus P4PE... Product = P4PE

Asus P4P800dlx... Product = P4P800

Abit BX6r2... Product = i440BX-W977 (BX6 R2.0)

Thinkpad T23.... Product = 2647CU5

(The IBM machinetype/model of the T23 I have is 2647-CU5 and is displayed that way in CMOS Setup and on the serial number sticker on the bottom of the unit).

So its a matter of calling the VB Script from a .CMD file, testing for the result, rather than displaying on screen, then running the appropriate apps that need to be installed.

But I have to test during an unattended install yet to see if it will run at that point and return the values.

Plus I don't really know VB script. (the above script based on scripts and info I found on MS TechNet) But I think I can figure it out enough to do a "If Then/Else" statement.

Link to comment
Share on other sites

I'm using many winnt.sif for different computers/configurations.

To include many winnt.sif files, look there:

http://www.911cd.net/forums/index.php?showtopic=3352

I'm using the cmdline.txt file to call a JScript (JavaScript) .js file wich then run the appropriate XPlode configuration:

[Commands]

"wscript ..\Programmes\scripts\xplode.js"

Shell = WScript.CreateObject("WScript.Shell");

Environnement_system = Shell.Environment("SYSTEM");

Environnement_process = Shell.Environment("PROCESS");

Network = WScript.CreateObject("WScript.Network");

fso = new ActiveXObject("Scripting.FileSystemObject");

date = new Date();

ForAppending = 8;

windir = Environnement_process("SYSTEMROOT")

systemdrive = Environnement_process("SYSTEMDRIVE");

ProgramFiles = Shell.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\ProgramFilesDir");

SourcePath = Shell.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\SourcePath");

UserProfile = Environnement_process("USERPROFILE");

UserProfileTous = Environnement_process("ALLUSERSPROFILE");

DefaultUserProfile = systemdrive + "\\Documents and Settings\\Default User\\";

QuickLaunch = UserProfile + "\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch\\";

MenuDemarrer = UserProfile + "\\Menu Démarrer\\Programmes\\";

Bureau = UserProfile + "\\Bureau\\";

QuickLaunchTous = UserProfileTous + "\\Application Data\\Microsoft\\Internet Explorer\\Quick Launch\\";

MenuDemarrerTous = UserProfileTous + "\\Menu Démarrer\\Programmes\\";

BureauTous = UserProfileTous + "\\Bureau\\";

path = WScript.ScriptFullName;

path = path.substr(0,path.lastIndexOf("\\")+1);

    // Variable RunOnceEx

RunOnceEx = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\RunOnceEx";

    // Fonction d'enregistrement de journeaux

function logging(erreur, commentaire) {

    try {

        if (!fso.FolderExists("C:\\logs")) {

            fso.CreateFolder("C:\\logs");

        }

        fichier = fso.OpenTextFile("c:\\logs\\xplode.log", ForAppending, true);

        if (date.getMinutes() < 10) {

            timestamp = "(" + date.getDate() + " " + (date.getMonth()+1) + " " + date.getYear() + ") " + date.getHours() + "h0" + date.getMinutes();

        }

        else {

            timestamp = "(" + date.getDate() + " " + (date.getMonth()+1) + " " + date.getYear() + ") " + date.getHours() + "h" + date.getMinutes();

        }

        fichier.WriteLine(timestamp + "\t Erreur: " + erreur + "\t (" + commentaire + ")");

        fichier.Close();

    }

    catch(e) { }

}

try {

    Shell.Run(SourcePath + "Programmes\\XPlode\\XPlode.exe /xml:"+ SourcePath + "Programmes\\XPlode\\" + Network.ComputerName + ".xml /log:" + systemdrive + "\\XPlode.log", 0, true);

}

catch(e) { logging(e, "Appel de XPlode par cmdlines.txt (" + Network.ComputerName + ")"); }

The xplode.js calls XPlode with the appropriate file based on the computer name (this needs a bit more tweaking, maybe help from t-39?)

So I can install Windows normally or unattended or both my Laptop and desktop, with different configuration and set of programs (I don't need many users on my laptop since I'm the one using it contrary to the desktop and I don't want the desktop to have specific tools for the laptop...)

JScript files are really nice. JScript is almost the same as JavaScript, which looks like Java and C++ (those languages are the first everyone learns...). You can do everything a batch file can, and more, in a verry clean way. One drawback is that if there is a bug/error/typo in the code, all the script won't execute. You can include though some error catching (like in the code above) that will write a .log about what went wrong! Batch files can't do that :)

I've putted in the code above some enironment variables which isnt needed for this script but needed for other script (I have always the same headers...)

By reading the registry, a .js can locate the CD drive xp is installing from (from the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\SourcePath) or even check on which drive it is running from:

PathAndNameToCurrentScript = WScript.ScriptFullName;

PathToCurrentScript = PathAndNameToCurrentScript.substr(0,PathAndNameToCurrentScript.lastIndexOf("\\")+1);

Link to comment
Share on other sites

I wasn't able to get to the 911cd site, so I am not sure on the method that is posted there, but here is what I do..

I used gosh's reducing size of source which creates a boot folder. I copied that folder X amount of times depending on how many different installs I want. I rename them to VOL1, VOL2, etc. Now since each boot folder has a winnt.sif, each can have their own drivers and at the end I make a call to a cmd file for custom applications.

Then (in my case I make 3 folders) under Drivers and Installs: common, desktop and notebook. My cmdlines.txt calls a cmd file which installs all the common stuff (using runonceex). Then my winnt.sif installs applications in the background which are specific to the computer (nonrunoncex).

Sorry if my explaination isn't very good. If this method seems like it might work for you, just add a reply and I can do a better job of explaining it.

]Bonkers[

Link to comment
Share on other sites

I've worked out what to do... Here goes:

At the cmdlines stage I have the install ask for an administrator name and write that to a file like so:

echo. > %systemdrive%\MSA\%NewAdmin%

Then, I have another batch that adds the RunOnceEx entries like so:

rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\RunOnceEx.inf
if exist %systemdrive%\MSA\RaveRod rundll32 setupapi,InstallHinfSection RaveRodInstall 128 .\RunOnceEx.inf
if exist %systemdrive%\MSA\MissCath rundll32 setupapi,InstallHinfSection MissCathInstall 128 .\RunOnceEx.inf

This ended up suiting my needs perfectly. Thanks for all your suggestions though.

Edit: Oh yes, I seperated the registry files (now INF files) into groups (Common, RaveRod and MissCath) and have the RunOnceEx.inf add the INF files based on what the username is. Works like a charm.

Link to comment
Share on other sites

  • 2 weeks later...

@RaveRod: Let me explain what I do a bit more clearly. I have a desktop and a laptop. They mostly have the same software, but a couple differ slightly. So my cmdlines.txt calls a batch that adds RunOnceEx entries which are common to both. Now, I have 2 different boot folders (I used the gosh method) and each boot folder has its own winnt.sif. So basically what happens is after windows is installed and reboots, my RunOnceEx is launched and installs my common stuff while my winnt.sif calls a batch file (which is hidden) that installs the computer specific software.

I would prefer to have all my installs done through RunOnceEx. I like your method and I think it is a great idea. Could you please post your file that asks for an admin name. I am not sure how to writeit.

Now, I am not sure if this idea would work or not, but maybe I can take your idea and expand on it. I would still prefer not to have to type something in, so what if we did this. (again, I can't program so bear with me).

In our winnt.sif we can name our computer and is assigned to the system variable %computername%. Now if our file (not sure what language to use) basically said:

If %computername% == computer1 (or whatever we name our comps) then run this file

If %computername% == computer2 then run the other file.

Is this possible? If so, can someone shed some light on the programming aspect.

]Bonkers[

Link to comment
Share on other sites

Ok, I wrote a post a while ago (when I first start that shed some light on the programming aspect).

This is to match my idea of having a common group of apps and some that are specific:

@ECHO OFF
starts common.cmd (adds common RunOnceEx entries)
If %computername%==Comp1 GOTO Computer1
If %computername%==Comp2 GOTO Computer2
:Computer1
starts Computer1.cmd (adds computer1 specfic RunOnceEx entries)
Goto END
:Install2
starts Computer2.cmd (adds computer2 specific RunOnceEx entries)
GOTO End
:END
ECHO Done
EXIT

]Bonkers[

Link to comment
Share on other sites

Edit: I knew I posted all this somewhere else: http://www.msfn.org/board/index.php?showtopic=21766 - Take a look at that. You might be able to understand it better.

@Bonkers: Here is my current setup of files (try and bear with me)...

First, at the cmdlines section of setup, I run "UserSetup.cmd"...

@echo off

%systemdrive%\MSA\Utilities\cmdow.exe @ /HID
title Setup Administrator Accounts

%systemdrive%\MSA\Utilities\renuser.exe Guest Disabled
net localgroup guests Disabled /delete
cls

%systemdrive%\MSA\Utilities\cmdow.exe @ /VIS
set /p NewAdmin="Enter a new administrator name: "
%systemdrive%\MSA\Utilities\cmdow.exe @ /HID

%systemdrive%\MSA\Utilities\renuser.exe Administrator %NewAdmin%
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v %NewAdmin% /t REG_DWORD /d 1 /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v RegisteredOwner /t REG_SZ /d %NewAdmin% /f
echo. > %systemdrive%\MSA\%NewAdmin%
cls

%systemdrive%\MSA\Utilities\cmdow.exe @ /VIS
set /p RemAdmin="Enter a remote administrator name: "
set /p RemPassd="Enter the remote administrator password: "
%systemdrive%\MSA\Utilities\cmdow.exe @ /HID

net user %RemAdmin% %RemPassd% /add
net localgroup Administrators %RemAdmin% /add
net localgroup users %RemAdmin% /delete

reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v %RemAdmin% /t REG_DWORD /d 0 /f

exit

As you can tell, that asks for the administrator name and saves it to a file.

Then, I have RunOnceEx.cmd called...

@echo off

%systemdrive%\MSA\Utilities\cmdow.exe @ /HID

rundll32 setupapi,InstallHinfSection DefaultInstall 128 .\RunOnceEx.inf
if exist %systemdrive%\MSA\RaveRod rundll32 setupapi,InstallHinfSection RaveRodInstall 128 .\RunOnceEx.inf
if exist %systemdrive%\MSA\MissCath rundll32 setupapi,InstallHinfSection MissCathInstall 128 .\RunOnceEx.inf

exit

That installs my RunOnceEx settings based on a username.

Here is my RunOnceEx.inf file...

[Version]
Signature="$Windows NT$"

[DefaultInstall]
AddReg = RunOnceEx.Default

[RaveRodInstall]
AddReg = RunOnceEx.RaveRod

[MissCathInstall]
AddReg = RunOnceEx.MissCath

[RunOnceEx.Default]
HKLM,%RunOnceEx%,Title,%REG_SZ%,"MSA Post Setup Installation"
HKLM,%RunOnceEx%\1000,,,"Installing WMP codecs..."
HKLM,%RunOnceEx%\1000,1,%REG_SZ%,"%24%\MSA\codecs.cmd"
HKLM,%RunOnceEx%\9000,,,"Adding registry entires..."
HKLM,%RunOnceEx%\9000,1,%REG_SZ%,"%24%\MSA\regedits_glob.cmd"
HKLM,%RunOnceEx%\9999,,,"Final Cleanup And Reboot..."
HKLM,%RunOnceEx%\9999,1,%REG_SZ%,"%24%\MSA\cleanup.cmd"

[RunOnceEx.RaveRod]
HKLM,%RunOnceEx%\9000,2,%REG_SZ%,"%24%\MSA\regedits_rave.cmd"

[RunOnceEx.MissCath]
HKLM,%RunOnceEx%\9000,2,%REG_SZ%,"%24%\MSA\regedits_miss.cmd"

[Strings]
RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

REG_SZ                  = 0x00000000
REG_BINARY              = 0x00000001
REG_SZ_NOCLOBBER        = 0x00000002
REG_BINARY_NOCLOBBER    = 0x00000003
REG_MULTI_SZ_APPEND     = 0x0001000A
REG_MULTI_SZ            = 0x00010000
REG_DWORD               = 0x00010001
REG_MULTI_SZ_NOCLOBBER  = 0x00010002
REG_DWORD_NOCLOBBER     = 0x00010003
REG_MULTI_SZ_DELVAL     = 0x00010006
REG_ADDREG_APPEND       = 0x00010008
REG_EXPAND_SZ           = 0x00020000
REG_EXPAND_SZ_NOCLOBBER = 0x00020002

It doesn't do much at the moment, but only because I just started converting to INF based installations... I'm working on my new CD now (just in time for SP2).

As I don't use gosh's method (I'm using nLite for now) I can't really say how you could use the multiple computer thingy. I don't mind answering questions at the cmdlines stage. I'm hoping to be able to place UserSetup.cmd file during the initial part of setup (where DetachedProgram runs).

Link to comment
Share on other sites

Hey RaveRod:

I am working on this too. I wrote my batches to an inf. Now I wanted to test my RunOnceEx sections... but I am having some trouble. First off, if I right click on my inf, and go install, it works.

But getting it to run from a cmd file doesn't want to work.

I have my inf and cmd in the same folder.

This is an editted version of my inf. I have more entries but they aren't important.

[Version]
Signature = "$Windows NT$"

[DefaultInstall]
AddReg = Common.RunOnceEx

[DesktopInstall]
AddReg = Desktop.RunOnceEx

[NotebookInstall]
AddReg = Notebook.RunOnceEx

[Common.RunOnceEx]
HKLM,"%RunOnceEx%\",Title,,"Installing Applications"
;Creates a c:\Windows\RunOnceEx.log file with status of commands
HKLM,"%RunOnceEX%\",Flags,0x00010001,20

HKLM,"%RunOnceEx%\0001",,,"Adware 6.181"
HKLM,"%RunOnceEx%\0001",1,,"%systemdrive%\installs\common\adware\aaw6.exe /S"

[Desktop.RunOnceEx]
HKLM,"%RunOnceEx%\0100",,,"APC PowerChute 1.03.1"
HKLM,"%RunOnceEx%\0100",1,,"%systemdrive%\installs\desktop\apc\setup.exe -s -f1\"%systemdrive%\installs\desktop\apc\setup.iss\""

[Notebook.RunOnceEx]
HKLM,"%RunOnceEx%\0100",,,"AC'97 Sound System 3.53"
HKLM,"%RunOnceEx%\0100",1,,"%systemdrive%\installs\notebook\realtek\setup.exe -s -f1\"%systemdrive%\installs\notebook\realtek\setup.iss\"

[Strings]
RunOnceEx = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx"

My cmd file:

@ECHO OFF
rundll32 setupapi,InstallHinfSection DefaultInstall 128 custom.inf
EXIT

Now from this I get a box that comes up and has a red circle with an X in the middle saying Installation Failed.

Any ideas

Thanks

]Bonkers[

Link to comment
Share on other sites

I suspect you may need to include the full path to the INF file (custom.inf). Even if it is in the same directory as your CMD file, it is not in the same directory as RUNDLL32. You can easily test this in your current system: you do not need to test it in a "live" install.

Link to comment
Share on other sites

Guest zippy

reg.exe works fine @T-39 when i call it in a cmd file.

@]bonkers[ you should include the full path to the inf file. when your cmd file runs, the current working directory is %SystemRoot%(or %SystemRoot%\system32 cant remember), not where your cmd file is.

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...