• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Update Registry Key On First Boot

Coucher

n00b
Joined
Aug 19, 2003
Messages
46
I have a need to update a specific registry key with the current date on the first boot of the machine after it is imaged.

Additionally, one issue is that the slashes have to be reversed. For example, if the date is 08/16/2009, the registry key needs to be updated to 08\16\2009.

What I'm visualizing is this:

A bat file of some sort that is set to run once on the first boot.

The bat file would somehow query for the current date, then create a reg file replacing the "/"s with "\"s.

Then execute the merging of the created reg file by invoking REGEDIT.EXE /S importfile.REG


This is just what I'm envisioning. If there's a better way, I'm definitely open to suggestions.

If it matters, this is what the created reg file with the current date would need to look like:

Code:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\PGP-IGA]

[HKEY_LOCAL_MACHINE\SOFTWARE\PGP-IGA\PREP]
"INSTALLDATE"="08\16\2009"

Thanks in advance for any help, assistance or advice!
 
Maybe Something like:

Code:
set startDate=%date%
set startTime=%time%

set sdy=%startDate:~10%
set /a sdm=1%startDate:~4,2% - 100
set /a sdd=1%startDate:~7,2% - 100
set /a sth=%startTime:~0,2%
set /a stm=1%startTime:~3,2% - 100
set /a sts=1%startTime:~6,2% - 100

echo %sdm%\%sdd%\%sdy%

I didnt test the echo line, the set lines are copied from a bat file i use on XP. may not work on lower os versions.

and you could append it to a partial .reg file, or echo the whole thing to a temp .reg file
i use it to create a logfile console-%sdy%.%sdm%.%sdd%-%sth%.%stm%.log

from the registry, you'll probably need to run it via cmd.exe (with /c ?) since .bat files arent directly executable
 
Got it working...

Ended up with:

Code:
@ECHO OFF
FOR /F "TOKENS=2-4 DELIMS=/ " %%A IN ('DATE /T') DO (
    REG ADD HKLM\SOFTWARE\PGA-IGA\PREP /V INSTALLDATE /D "%%A\%%B\%%C" /F>NUL)
del %0
 
Back
Top