Jump to content

Temp Environmental Variables On Install


 Share

Recommended Posts

Hi all,

relatively new to unattended installations but in saying that, Im quite computer savvy anyway.

I've searched through the forum and know you can use a reg file to amend the global environmental variable for the temp/tmp folder (which usually points to C:\Windows\Temp). The key in question being:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"TEMP"="C:\\Windows\\Temp"
"TMP"="C:\\Windows\\Temp"

What I'd like to know is when is the earliest possible point to set this during the installation timeline.

... I had thought about setting this in HIVESYS.INF file as I can see some of the environmental variables are set in there e.g.

HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","ComSpec",0x00020002,"%SystemRoot%\system32\cmd.exe"

I thought I'd just throw this out there to see what people thought, I prefer the idea of the HiveSys approach to be honest... but was worried that it would get overwritten at a later point in the install process.

Thanks in advance.

Steve

Edited by Twilley
Link to comment
Share on other sites


Just running on from my idea of editting the HIVESYS.INF, I've seen an alternative on this forum of creating my own HIVExxx.INF file and adding it to the TXTSETUP.SIF file and DOSNET.INF files.. which I suppose would be a neater way to do the same without having to edit the HIVESYS.INF file.

I assume with this approach I add my own HIVExxx file to the TXTSETUP.SIF file in the [sourceDisksFiles] section much like the other hive files

hivexxx.inf  = 100,,,,,,_x,,3,3

and also at the end of the [HiveInfs.Fresh] section

AddReg = hivexxx.inf,AddReg

and finally adding a line to the DOSNET.INF file in the [Files] section

d1,hivexxx.inf

---

I know this is just a different approach to what I mentioned before, I just prefer the idea of loading settings as earlier on as possible providing they're not going to be overwritten by some other process during the installation. I'd test it but Im in need of some rewrittables as my current ones are on their last legs and prone to errors.

Link to comment
Share on other sites

Ok, I tested using my own hivexxx.inf file which followed after the other hive files... this approach didn't work, or more likely was overwritten at a later point during installation. I added a test variable to the hivexxx file to see if it was implemented and this was shown in the registry after the install. Find below what I attempted (just to note, also attempted to set the page file location which didnt work either):

[Version]
Signature = "$Windows NT$"
DriverVer=07/01/2001,5.1.2600.3264

[DelReg]
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management","PagingFiles"

[AddReg]
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management","PagingFiles",0x00010000,"D:\pagefile.sys 1800 1800"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","TEMP",0x00020000,"E:\Windows\Temp"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","TMP",0x00020000,"E:\Windows\Temp"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","MyTMP",0x00020000,"E:\Windows\Temp"

Just to let you know, Windows is installed on C much in the usual way, but I have a small D partition and then E for user files, which is where I wanted the Temp folder to be as well (I put it within a Windows folder only so it mimics the normal folder structure).

So my question now basically is, when is the earliest point I can implement this?

Is "%SystemRoot%\TEMP" hard-coded in to Windows as well as "C:\pagefile.sys 768 1536" or is the a file to edit somewhere in the i386 folder to change this? (I prefer the idea of editting one of these files if possible rather than a user script of sorts as I want to make these changes as early as possible)

Edited by Twilley
Link to comment
Share on other sites

Ok, I tested using my own hivexxx.inf file which followed after the other hive files... this approach didn't work, or more likely was overwritten at a later point during installation. I added a test variable to the hivexxx file to see if it was implemented and this was shown in the registry after the install. Find below what I attempted (just to note, also attempted to set the page file location which didnt work either):

[Version]
Signature = "$Windows NT$"
DriverVer=07/01/2001,5.1.2600.3264

[DelReg]
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management","PagingFiles"

[AddReg]
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management","PagingFiles",0x00010000,"D:\pagefile.sys 1800 1800"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","TEMP",0x00020000,"E:\Windows\Temp"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","TMP",0x00020000,"E:\Windows\Temp"
HKLM,"SYSTEM\CurrentControlSet\Control\Session Manager\Environment","MyTMP",0x00020000,"E:\Windows\Temp"

Just to let you know, Windows is installed on C much in the usual way, but I have a small D partition and then E for user files, which is where I wanted the Temp folder to be as well (I put it within a Windows folder only so it mimics the normal folder structure).

So my question now basically is, when is the earliest point I can implement this?

Is "%SystemRoot%\TEMP" hard-coded in to Windows as well as "C:\pagefile.sys 768 1536" or is the a file to edit somewhere in the i386 folder to change this? (I prefer the idea of editting one of these files if possible rather than a user script of sorts as I want to make these changes as early as possible)

Nice documentation there. That helps the people who CAN help... to be able. :):thumbup

Link to comment
Share on other sites

Well I've had no luck finding a variable anywhere which sets the default temp folder for the machine (as opposed to local users).

What I ended up doing though was writing a script to export the registry at cmdlines.txt and GuiRunOnce to compare the changes... thought this may come in handy for other things.

The common setting of TEMP=C:\Windows\Temp or such was already set by the cmdlines execution stage so I'll set the variables then (assuming they're not overwritten again!).

What I also noticed in the setuplog.txt after installation was that the cmdlines execution is just moments after Virtual Memory is set:

02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\syssetup.c,3939,BEGIN_SECTION,Setting up virtual memory
02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\log.c,133,,SetUpVirtualMemory: ENTER

02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: C:\, spc=8, bps=512, freeclus=723262, totalclus=1024372

02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: C:\, FreeSpace = 02962481152

02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: C:\ had 120586240 byte pagefile, new FreeSpace = 03083067392

02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: Free space on C:\ is 2940 MB

02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: D:\, spc=2, bps=512, freeclus=1006242, totalclus=1020568

02/12/2008 12:49:28.427,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: D:\, FreeSpace = 01030391808

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: Free space on D:\ is 982 MB

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: E:\, spc=8, bps=512, freeclus=635675, totalclus=640702

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: E:\, FreeSpace = 02603724800

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,BuildVolumeFreeSpaceList: Free space on E:\ is 2483 MB

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,SetUpVirtualMemory: loc 1

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,Setup configured the system to place a 768 MB pagefile on drive C:.

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,Crashdump was enabled.

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\log.c,133,,SetUpVirtualMemory: EXIT (1)

02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\syssetup.c,3947,END_SECTION,Setting up virtual memory
02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\syssetup.c,3958,BEGIN_SECTION,Processing [RunPrograms] section
02/12/2008 12:49:28.437,d:\xpsp\base\ntsetup\syssetup\syssetup.c,3960,END_SECTION,Processing [RunPrograms] section
02/12/2008 12:49:28.658,d:\xpsp\base\ntsetup\syssetup\syssetup.c,2715,,Power scheme: laptop.
02/12/2008 12:49:28.708,d:\xpsp\base\ntsetup\syssetup\syssetup.c,2719,,SetActivePwrScheme succeeded.
02/12/2008 12:49:34.716,d:\xpsp\base\ntsetup\syssetup\log.c,133,,The external program exportreg.cmd returned exit code 0.

02/12/2008 12:49:34.726,d:\xpsp\base\ntsetup\syssetup\syssetup.c,4018,BEGIN_SECTION,Saving hives
02/12/2008 12:49:34.826,d:\xpsp\base\ntsetup\syssetup\syssetup.c,4032,END_SECTION,Saving hives

'exportreg.cmd' is what I had executing at the cmdlines.txt point in installation and considering how close it is to the Virtual Memory setting stage of installation, it seemed a perfect point to set that as well:

REG ADD "HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\SESSION MANAGER\MEMORY MANAGEMENT" /V PagingFiles /t REG_MULTI_SZ /d "E:\pagefile.sys 1800 1800" /f

I think I'll have to settle for setting my environmental variables using cmdlines, its not as neat / perfect as I'd have wanted it but beggars can't be choosers!.

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.


×
×
  • Create New...