Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Best practice for HKCU adds/app installs needed


  • Please log in to reply
12 replies to this topic

#1
Mikka

Mikka

    Junior

  • Member
  • Pip
  • 80 posts
  • OS:none specified
  • Country: Country Flag
Hi pros,

In the past, I found out some tricks to successfully tinker a customized Windows XP installation including default user profile & system settings, unattended apps (Flash plugin) and paths (winnt.sif).
I'd like to get something similar for Windows 7 x64 sp1. I realized a working autounattend.xml and a $oem$ structure.

This is my current situation:
I can't use autounattend.xml (oobeSystem, FirstLogonCommands...) for running scripts (cmd) that peek into %UserProfile%, because no user exists then.
A RunOnceEx mechanism is gone, so I'm looking for some sort of substitute to execute my scripts at a later date (T+x instead of T-x).

For the nonce, there are shortcuts.cmd (moving & deleting links), userpics.cmd (tidying up "usertiles") and views.cmd (customizing Windows Explorer view via registry).
I don't want to create users, I only adjust the local Administrator account (no domain stuff either). Optionally, I'd also like to initiate a few silent installers (Flash plugin etc.).

There should be several ways to achieve this, like manipulating the file install.wim with DISM or executing scripts afterwards.

Any ideas?

Thanks in advance.


How to remove advertisement from MSFN

#2
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,693 posts
  • OS:Server 2012
  • Country: Country Flag

Donator

Look at this thread, starting with this post:
http://www.msfn.org/...ost__p__1015918

You can add things to "DEFAULT" user account, if you need to load the "HKCU" you'll find that in NTUSER.DAT in the Users\Default folder.
MSFN RULES | GimageX HTA for PE 3.x | lol probloms
msfn2_zpsc37c7153.jpg

#3
maxXPsoft

maxXPsoft

    MSFN Master

  • Developer
  • 2,880 posts
  • OS:Windows 7 x64
  • Country: Country Flag
The user does exist at FirstLogonCommands. I run a themepack install, copy Favorites, set my Powerplan and apply my tweaks REGEDIT /S %systemdrive%\Install\Se7en_UATweaks.reg
I do most of that with DVD\sources\$OEM$ http://www.msfn.org/...-an-oem-folder/
and RunOnceEx is still alive and well even on Win 8

Edited by maxXPsoft, 06 November 2012 - 01:07 AM.

Download ++> Windows 7 + 8 Unattended DVD + App Installer + Services Disabler + Load All Button + XML Creator
Jump2Reg - Registry: - Oct 4, 2013 - Version 3.0.4 - 98, ME, NT, 2K, XP, VISTA, Seven, Windows 8+ and 32 or 64 bit

XP Unattended CD/DVD creator - Version 4.1.7
Sample xml + Setupcomplete + Add Right click .wim Windows 7 or Windows 8/8.1

#4
Mikka

Mikka

    Junior

  • Member
  • Pip
  • 80 posts
  • OS:none specified
  • Country: Country Flag
Thank you.

@Tripredacus: I'm unsure how to import registry files.
That way would really facilitate things...

@maxXPsoft: Yes, that was my first idea. Actually, I have:

W7DVD
   Autounattend.xml
W7DVD\sources\$oem$
   $$
          $$\setup\scripts ← setupcomplete.cmd, activate.cmd...
   $1
          $1\a_tmp_folder
          $1\Install ← RunOnceEx.cmd, shortcuts.cmd, userpics.cmd, views.cmd...

I commented out the <FirstLogonCommands> section of my Autounattend.xml as setupcomplete.cmd will be processed anyway.
My setupcomplete.cmd contains:

@echo off
start /wait C:\Windows\setup\scripts\activate.cmd
start /wait C:\Install\RunOnceEx.cmd
exit/b 0
And a (basic) RunOnceEx.cmd looks like this:

@echo off
SetLocal enableextensions

Set K=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

Reg add %K%      /f

Reg add %K%      /f /v Flags /t REG_DWORD /d "20"
Reg add %K%      /f /v Title /d "Post setup"

Reg add %K%\10 /f /ve  /d "User Pictures"
Reg add %K%\10 /f /v 1 /d "%SystemDrive%\Install\userpics.cmd"

Reg add %K%\20 /f /ve  /d "Explorer Views & Shortcuts"
Reg add %K%\20 /f /v 1 /d "%SystemDrive%\Install\views.cmd"
Reg add %K%\20 /f /v 2 /d "%SystemDrive%\Install\shortcuts.cmd"

Reg add %K%\30 /f /ve  /d "Reboot"
Reg add %K%\30 /f /v 1 /d "shutdown.exe /f /r /t 50"
REM rundll32.exe iernonce.dll,RunOnceExProcess

EndLocal
Exit/b 0
However, something has to be wrong, I cannot tell if SetupComplete.cmd or RunOnceEx.cmd is the culprit.
(The RunOnceEx.cmd doesn't look so much differently from what I did in the past.)
My test installation (VMware) stalls with the following screen, not loading Desktop settings for the first time:

Attached File  bl_scr.png   6.66KB   5 downloads

I'll comment out the 2nd line of setupcomplete.cmd and try again, I'm quite clueless right now. :(

Edited by Mikka, 06 November 2012 - 08:41 AM.


#5
maxXPsoft

maxXPsoft

    MSFN Master

  • Developer
  • 2,880 posts
  • OS:Windows 7 x64
  • Country: Country Flag
uaDVD\sources\$OEM$\$$\SETUP\Scripts\Setupcomplete.cmd Setupcomplete.cmd runs right before Load Desktop and can be used to complete Final Steps. HKLM Reg tweaks can be ran here but not HKCU which are user specific. I run updates and stuff which can't be injected like directx_Jun2010_redist.exe, VisualC++RedistInstallerV17.exe

Use Firstlogoncommands but then you wouldn't need the RunOnceEx unless you want to do something on reboot. I delete Install folder with that
REG ADD HKCU\Software\Microsoft\Windows\CurrentVersion\Runonce /V DelInstall /D "Cmd /C RMDIR %systemdrive%\Install\ /S /Q" /f

You could just call your file in Firstlogoncommands and remove the REM rundll32 or add all your files there and run them

<SynchronousCommand wcm:action="add">
                    <Order>2</Order>
                    <Description>Running Firstlogon.cmd</Description>
                    <CommandLine>cmd /C start /wait %systemdrive%\Install\Firstlogon.cmd</CommandLine>
                </SynchronousCommand>

Edited by maxXPsoft, 06 November 2012 - 09:08 AM.

Download ++> Windows 7 + 8 Unattended DVD + App Installer + Services Disabler + Load All Button + XML Creator
Jump2Reg - Registry: - Oct 4, 2013 - Version 3.0.4 - 98, ME, NT, 2K, XP, VISTA, Seven, Windows 8+ and 32 or 64 bit

XP Unattended CD/DVD creator - Version 4.1.7
Sample xml + Setupcomplete + Add Right click .wim Windows 7 or Windows 8/8.1

#6
Mikka

Mikka

    Junior

  • Member
  • Pip
  • 80 posts
  • OS:none specified
  • Country: Country Flag
1. RunOnceEx.cmd (or Firstlogon.cmd):
You meant to delete the lines:

Reg add %K%\30 ...

and to re-active/uncomment:

rundll32.exe iernonce.dll,RunOnceExProcess

?

2. The file Autounattend.xml now reads

...
        <FirstLogonCommands>
            <SynchronousCommand wcm:action="add">
                <CommandLine>start /wait %systemdrive%\Windows\setup\scripts\activate.cmd</CommandLine>
                <Order>1</Order>
                <RequiresUserInput>false</RequiresUserInput>
            </SynchronousCommand>
            <SynchronousCommand wcm:action="add">
                <CommandLine>start /wait %systemdrive%\Install\RunOnceEx.cmd</CommandLine>
                <Order>2</Order>
                <RequiresUserInput>false</RequiresUserInput>
            </SynchronousCommand>
        </FirstLogonCommands>
...
The 1st command is correctly processed, but not the 2nd. Don't know why. :blink:

Just the setup won't stall this time. RunOnceEx, however, still doesn't work.

#7
maxXPsoft

maxXPsoft

    MSFN Master

  • Developer
  • 2,880 posts
  • OS:Windows 7 x64
  • Country: Country Flag
<RequiresUserInput> remove those lines. Default and best not to add

I meant you could probably run all your cmd's one after another instead of the 1 file doing the RunOnceEx
Download ++> Windows 7 + 8 Unattended DVD + App Installer + Services Disabler + Load All Button + XML Creator
Jump2Reg - Registry: - Oct 4, 2013 - Version 3.0.4 - 98, ME, NT, 2K, XP, VISTA, Seven, Windows 8+ and 32 or 64 bit

XP Unattended CD/DVD creator - Version 4.1.7
Sample xml + Setupcomplete + Add Right click .wim Windows 7 or Windows 8/8.1

#8
Mikka

Mikka

    Junior

  • Member
  • Pip
  • 80 posts
  • OS:none specified
  • Country: Country Flag
Thank you, maxXPsoft. Things are improving slowly...

Now I've got a RunOnceEx functionality -- sort of.

It isn't really unattended, which means: The cmd instances stay open, and must be closed manually.
I don't know why, I checked with exit, exit /b 0... and so forth.

My current RunOnceEx.cmd reads:

@echo off
SetLocal enableextensions

Set K=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

Reg add %K%    /f
Reg add %K%    /f /v Flags /t REG_DWORD /d 20
Reg add %K%    /f /v Title /d "Post setup"

Reg add %K%\10 /f /ve  /d "Console"
Reg add %K%\10 /f /v 1 /d "reg import %SystemDrive%\Install\console.reg"

Reg add %K%\20 /f /ve  /d "Remove unnecessary fonts"
Reg add %K%\20 /f /v 1 /d "%SystemDrive%\Install\rm_extra_fonts.cmd"

Reg add %K%\30 /f /ve  /d "User Pictures"
Reg add %K%\30 /f /v 1 /d "%SystemDrive%\Install\userpics.cmd"

Reg add %K%\40 /f /ve  /d "Views & Shortcuts"
Reg add %K%\40 /f /v 1 /d "%SystemDrive%\Install\rm_views.cmd"
Reg add %K%\40 /f /v 2 /d "%SystemDrive%\Install\shortcuts.cmd"

Reg add %K%\50 /f /ve  /d "IE9 Flash ActiveX"
Reg add %K%\50 /f /v 1 /d "%SystemDrive%\Install\flPlayer_ax.exe"

Reg add %K%\60 /f /ve  /d "Silent Visual C++ Redistributable"
Reg add %K%\60 /f /v 1 /d "%SystemDrive%\Install\vcRedist.exe auto"

Reg add %K%\70 /f /ve  /d "Reboot"
Reg add %K%\70 /f /v 1 /d "shutdown.exe /r /t 100"

rundll32.exe iernonce.dll,RunOnceExProcess
EndLocal

Exit /b 0
In my Autounattend.xml I edited the CommandLines to read:

<FirstLogonCommands>
      <SynchronousCommand wcm:action="add">
          <CommandLine>cmd /C start /wait %systemdrive%\Windows\setup\scripts\activate.cmd</CommandLine>
          <Order>1</Order>
      </SynchronousCommand>
      <SynchronousCommand wcm:action="add">
          <CommandLine>cmd /C start /wait %systemdrive%\Install\RunOnceEx.cmd</CommandLine>
          <Order>2</Order>
      </SynchronousCommand>
  </FirstLogonCommands>
I don't see a difference stuffing single commands into <SynchronousCommand> sections or calling one cmd containing the necessary commands.

Well, what might that be...?

#9
maxXPsoft

maxXPsoft

    MSFN Master

  • Developer
  • 2,880 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Add CMD /C Start /Wait in front of each and then add Exit last line of each file
Reg add %K%\20 /f /v 1 /d "CMD /C Start /Wait %SystemDrive%\Install\rm_extra_fonts.cmd"
Download ++> Windows 7 + 8 Unattended DVD + App Installer + Services Disabler + Load All Button + XML Creator
Jump2Reg - Registry: - Oct 4, 2013 - Version 3.0.4 - 98, ME, NT, 2K, XP, VISTA, Seven, Windows 8+ and 32 or 64 bit

XP Unattended CD/DVD creator - Version 4.1.7
Sample xml + Setupcomplete + Add Right click .wim Windows 7 or Windows 8/8.1

#10
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,693 posts
  • OS:Server 2012
  • Country: Country Flag

Donator

Alternatively, if you don't want to see the CMDs on the screen, you can use CMD /K instead.
MSFN RULES | GimageX HTA for PE 3.x | lol probloms
msfn2_zpsc37c7153.jpg

#11
Mikka

Mikka

    Junior

  • Member
  • Pip
  • 80 posts
  • OS:none specified
  • Country: Country Flag
It's odd, but obviously RunOnceEx behaves differently in Windows 7 compared to Windows XP.

In short: It didn't work with cmd /c start /wait %SystemDrive%\Install\rm_extra_fonts.cmd.
After removing the start /wait part, finally the cmd instance auto-closed. (Combined with hidec.exe /w an output may be completely hidden.)

Checking the test installation I noticed that several changes of the cmd scripts weren't carried out properly.
I had to execute rm_views.cmd and shortcuts.cmd again manually, that's annoying.
I assume that it has to do with the moment when the Windows graphics (theme) is loaded, all my cmd scripts run before.

In Windows XP I sorted shortcuts with a VBS script at one of the last RunOnceEx entries (and I remember that at first it didn't work as expected).
Registry files are also not fully applied (e.g. via reg import HKCU.reg) yet.
:no:

Addendum:
In some thread I saw an example of a cmd script (copying stuff to a virgin installation) with several Timeout /t 1 in it.
Do you use this command and if so, under which circumstances?

Edited by Mikka, 12 November 2012 - 05:21 AM.


#12
maxXPsoft

maxXPsoft

    MSFN Master

  • Developer
  • 2,880 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Try removing SetLocal enableextensions. I don't use that and mine works
/k also don't seem to work for me

Maybe some examples
Firefox which I have been doing for quite some time and I am completely setup afterwards. I may still have to enter a pass on some sites but some work
I do use an Autoit script with this available here http://www.msfn.org/...post__p__888493
Notice Example Firefox 3.x.x: on my post there. yes same way since version 3.x
EDIT: Still works even with Windows 8

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %KEY% /V TITLE /D "RunOnceEx - Testing Applications" /f
REG ADD %KEY% /v Flags /t REG_DWORD /d "20" /f

REG ADD %KEY%\1001 /VE /D "Mozilla Firefox 16.xx" /f
REG ADD %KEY%\1001 /V 101 /D "CMD /C Start /Wait D:\APPS\Mozilla.Firefox_X.XX\Firefox_autoit.exe" /f
REG ADD %KEY%\1001 /V 102 /D "CMD /C Start /Wait Timeout 3" /f
REG ADD %KEY%\1001 /V 103 /D "CMD /C RD \"%USERPROFILE%\AppData\Roaming\Mozilla\Firefox\" /S /Q" /f
REG ADD %KEY%\1001 /V 104 /D "CMD /C Start /Wait Timeout 3" /f
REG ADD %KEY%\1001 /V 105 /D "cmd /c XCOPY \"D:\APPS\Mozilla.Firefox_X.XX\Firefox\" \"C:\Users\Maxxpsoft\AppData\Roaming\Mozilla\Firefox\" /E /I /H /R /Y" /f
REG ADD %KEY%\1001 /V 106 /D "CMD /C DEL \"%SystemDrive%\Users\Public\Desktop\Mozilla Firefox.lnk\"" /f
REG ADD %KEY%\1001 /V 107 /D "CMD /C REG DELETE \"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService\" /f" /f"
REG ADD %KEY%\1001 /V 108 /D "CMD /C Start /Wait \"%ProgramFiles(x86)%\Mozilla Maintenance Service\uninstall.exe\" /S" /f

REG ADD %KEY%\1001 /VE /D "Microsoft Security Essentials x64" /f
REG ADD %KEY%\1001 /V 101 /D "CMD /C Start /Wait D:\APPS\MS_SecurityEssentials_x64\mseinstall.exe /s /runwgacheck" /f
REG ADD %KEY%\1001 /V 102 /D "CMD /C Start /Wait D:\APPS\MS_SecurityEssentials_x64\SecurityEssentials64.cmd" /f
SecurityEssentials64.cmd uses TASKKILL /F /IM msseces.exe and then it uses setacl to gain permission on registry for Aministrators on keys and set my settings and then return those keys back
Then start "" "C:\Program Files\Microsoft Security Client\msseces.exe"

Edited by maxXPsoft, 12 November 2012 - 07:35 AM.

Download ++> Windows 7 + 8 Unattended DVD + App Installer + Services Disabler + Load All Button + XML Creator
Jump2Reg - Registry: - Oct 4, 2013 - Version 3.0.4 - 98, ME, NT, 2K, XP, VISTA, Seven, Windows 8+ and 32 or 64 bit

XP Unattended CD/DVD creator - Version 4.1.7
Sample xml + Setupcomplete + Add Right click .wim Windows 7 or Windows 8/8.1

#13
Mikka

Mikka

    Junior

  • Member
  • Pip
  • 80 posts
  • OS:none specified
  • Country: Country Flag
Interesting approach, maxXPsoft.

I found another one that's working for me. In fact, it's rather simple:

Reg add %K%\100 /f /ve /d "Shortcuts"
Reg add %K%\100 /f /v 1 /d "reg.exe add \"HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce\" /f /v 1 /d %SystemDrive%\Install\shortcuts.cmd"
Reg add %K%\100 /f /v 2 /d "reg.exe add \"HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce\" /f /v 2 /d %SystemDrive%\Install\cleanup.cmd"

Reg add %K%\110 /f /ve /d "Reboot"
Reg add %K%\110 /f /v 1 /d "shutdown.exe /r /t 30"

A user profile must be accomplished before messing with shortcuts...
Also, tidying up the system partition is reasonably done then, too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN