Jump to content

RunOnceEx failing on Windows 7 SP1


Recommended Posts

Hello mates,

I was able to install my all my Applications during Windows XP SP3 setup using RunOnceEx.cmd. There has absolutely been no issues and everything went on smoothly. I also was successful in installing my Application during Windows 7 Ultimate SP1 Setup by using SetupComplete.cmd.

My Concern - Windows 7 UL installation takes time as it has to copy all the Applications from $OEM$\$$\Setup\Scripts to my HDD and then run the SetupComplete.cmd. My Scripts folder has all my Silent Apps and SetupComplete.cmd

Now this is what i want to achieve -

I want to install all my Apps from CD / DVD /USB Stick without copying them to the HDD. I have gone through numerous posts and have followed the instructions -

1. Under $OEM$\$$\Setup\Scripts I have my SetupComplete.cmd where i have the following script

cmdow @ /HID@echo offFOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.txt SET CDROM=%%i:REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExSET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications" /fREG ADD %KEY%\001 /VE /D "7 Zip" /fREG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\7ZIP.exe" /fREG ADD %KEY%\003 /VE /D "Acrobat Reader" /fREG ADD %KEY%\003 /V 1 /D "%CDROM%\Software\ACROBAT.exe" /fREG ADD %KEY%\005 /VE /D "CD BurnerXP" /fREG ADD %KEY%\005 /V 1 /D "%CDROM%\Software\CDBURNER.exe" /fREG ADD %KEY%\007 /VE /D "Mozilla Firefox" /fREG ADD %KEY%\007 /V 1 /D "%CDROM%\Software\FIREFOX.exe" /fREG ADD %KEY%\009 /VE /D "FLASH ACTIVEX" /fREG ADD %KEY%\009 /V 1 /D "%CDROM%\Software\FLASHAX.exe" /fREG ADD %KEY%\011 /VE /D "FLASH PLUG-in" /fREG ADD %KEY%\011 /V 1 /D "%CDROM%\Software\FLASHPLUGIN.exe" /fREG ADD %KEY%\013 /VE /D "Google Chrome" /fREG ADD %KEY%\013 /V 1 /D "%CDROM%\Software\GOOGLECHROME.exe" /fREG ADD %KEY%\015 /VE /D "KLite Media Pack" /fREG ADD %KEY%\015 /V 1 /D "%CDROM%\Software\KLITE.exe" /fREG ADD %KEY%\017 /VE /D "Maleware Bytes Antimaleware" /fREG ADD %KEY%\017 /V 1 /D "%CDROM%\Software\MALEWAREBYTES.exe" /fREG ADD %KEY%\019 /VE /D "Microsoft Office 2007" /fREG ADD %KEY%\019 /V 1 /D "%CDROM%\Software\O2K7.exe" /fREG ADD %KEY%\021 /VE /D "Silverlight Plugin" /fREG ADD %KEY%\021 /V 1 /D "%CDROM%\Software\Slvrlight.exe" /fREG ADD %KEY%\023 /VE /D "Winamp Media Player" /fREG ADD %KEY%\023 /V 1 /D "%CDROM%\Software\WINAMP.exe" /f::CLEAN-UPattrib -R -A -S -H *.*SHUTDOWN /R /T 5cd..RMDIR /S /Q "%WINDIR%\Setup\Scripts"EXIT

I dont have any silent switch added to these apps because they are already repackaged using silent switches. They run absolutely without any problems / screens / prompts / restarts when I use them using SetupComplete.cmd

I am also pasting CMDOW file inside the $OEM$/$$/Setup/System32.

Kindly help me to achieve this. I do not have any UNATTENDED/ ANSWER File. I do not want to try out third party like RT7Lite.

Am I missing something ? Kindly guide me

Link to comment
Share on other sites


It don't matter. If you don't use start /wait on each item then 1 starts, then next, then next. It will run them one after the other and you have a mess

Commands in the Setupcomplete.cmd file are executed with local system privilege.
HKLM Reg tweaks can be ran here but not HKCU which are user specific.

Therefore if any of your programs need to write to HKCU like 7-zip [HKEY_CURRENT_USER\Software\Classes\.7z]

then it probably crashing. Not just reg but adding things to userprofile also. Programs are best executed after Firstlogoncommands

I only add a few updates and Directx in Setupcomplete. Things can't be injected

Edited by maxXPsoft
Link to comment
Share on other sites

You mean -

ECHO Please wait...

start /wait %systemroot%\Setup\Scripts\7ZIP.exe
ECHO.Done
Ok, then what would be the best way to install these Apps ? I have used SetupComplete.cmd with the command line above and it works fine. My only concern is it takes a little longer because my APP folder contains all the Silent.exe apps which first gets copied to HDD and then executes via SetupComplete.cmd
Is there a way to run these Apps from CD / DVD without copying them to local system ? Because if I create a folder say - Software in Windows Root DVD then how will SetupComplete.cmd trigger the exe inside my Software folder ? I have three systems and DVD / USB drive letter may vary.
Link to comment
Share on other sites

Your FOR %%i IN should work as its same as this in xml http://www.msfn.org/board/topic/139572-ask-your-seven-xml-here/?p=953464

you could place the apps in $OEM$\$1\Software and it will be copied over really early on then just do

%systemdrive%\Software

Your not executing RunOnceEx so it only adds to the registry so I don't know if that is transferring to the user profile. Never done it but I will experiment myself. To execute it you must add after last app

rundll32.exe iernonce.dll,RunOnceExProcess

RunOnceEx still works with Win 8.1

Edited by maxXPsoft
Link to comment
Share on other sites

Things that has been tried...

1.Checked regedit but did not find any Runonceex key.

2. Turned off UAC, then ran the SetupComplete.cmd again

3.Then logged off and logged in again to Windows

4. Was able to see RunOnceEx getting executed.

This means the script is error free. It requires UAC turned off so I created an answer file and started to install Windows 7 again. This time Was able to log in with UAC turned off but the script did not run .... I am definitely doing something wrong.

Can you guys tell me if I need to put in CMDLINES.TXT anywhere in the $OEM$ folder?

Link to comment
Share on other sites

This means the script is error free. It requires UAC turned off so I created an answer file and started to install Windows 7 again. This time Was able to log in with UAC turned off but the script did not run .... I am definitely doing something wrong.

Are you sure it isn't running? It running does not necessarily mean it is processing the commands. You can add some lines that copy files at the beginning and end of the cmd. So you can see if it actually run, or if the cmd is exiting due to error.

Link to comment
Share on other sites

For Windows xp I followed this guide http://unattended.msfn.org/unattended.xp/view/web/59/

Could not find any crystal clear tutorial for Windows 7 regarding RunOnceEx :(

I think we are walking the same path here, unfortunately nobody seems to know or cares to help. I found this page that explains one way of running RunOnce, I'm unsure this is the only way, it involves loading hive on WinToolkit, but I doubt that's the only way, in nlite you just added a .bat file on the RunOnce box and that was all.

Link to comment
Share on other sites

I think there's another way adding this at the end of your autounattend.xml, before closing component.

            <FirstLogonCommands>                <SynchronousCommand wcm:action="add">                    <CommandLine>Path\RunOnce.cmd</CommandLine>                    <Order>1</Order>                </SynchronousCommand>            </FirstLogonCommands>
Link to comment
Share on other sites

I think there's a third (and more proper) way of doing it, I think the WinToolkit section called Silent Installs can run bat files on first logon, and work as expected. Nontheless I'm curious to hear your solution.

Link to comment
Share on other sites

These are the steps i followed ..

1. Edited Win7SP1.iso in WinISO

2. Created folder in sources directory -- $OEM$/$$/Setup/Scripts/SetupComplete.cmd (Dont know if uppercase/lowercase makes any difference but I renamed my folders exactly the same way I am mentioning here.

3. Create a folder named - Software in the DVD Root

4. Copied all my Silent Applications inside the Software folder

5. Edited the SetupComplete.cmd file mentioned above and removed the very first line - cmdow @ /HID ( Reason - cmdow showed unrecognised internal command while testing and running the script)

6. Copied my SetupComplete.cmd file inside the Scripts folder

7. Created a blank text file called - CD.txt so that when the script is run, it finds this blank file and sets the CDROM variable.

8. Then saved as New ISO

9. Tested the ISO and was able to Install all the Apps during Windows Installation

I also added few registry entries into my SetupComplete.cmd and saved the reg files inside the Apps Folder. This is how my SetupComplete.cmd looks like

@echo offFOR %%i IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%i:\CD.txt SET CDROM=%%i:REG ADD HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExSET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceExREG ADD %KEY% /V TITLE /D "Installing Applications" /fREG ADD %KEY%\001 /VE /D "7 Zip" /fREG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\7ZIP.exe" /fREG ADD %KEY%\003 /VE /D "Acrobat Reader" /fREG ADD %KEY%\003 /V 1 /D "%CDROM%\Software\ACROBAT.exe" /fREG ADD %KEY%\005 /VE /D "CD BurnerXP" /fREG ADD %KEY%\005 /V 1 /D "%CDROM%\Software\CDBURNER.exe" /fREG ADD %KEY%\007 /VE /D "Mozilla Firefox" /fREG ADD %KEY%\007 /V 1 /D "%CDROM%\Software\FIREFOX.exe" /fREG ADD %KEY%\009 /VE /D "FLASH ACTIVEX" /fREG ADD %KEY%\009 /V 1 /D "%CDROM%\Software\FLASHAX.exe" /fREG ADD %KEY%\011 /VE /D "FLASH PLUG-in" /fREG ADD %KEY%\011 /V 1 /D "%CDROM%\Software\FLASHPLUGIN.exe" /fREG ADD %KEY%\013 /VE /D "Google Chrome" /fREG ADD %KEY%\013 /V 1 /D "%CDROM%\Software\GOOGLECHROME.exe" /fREG ADD %KEY%\015 /VE /D "KLite Media Pack" /fREG ADD %KEY%\015 /V 1 /D "%CDROM%\Software\KLITE.exe" /fREG ADD %KEY%\017 /VE /D "Maleware Bytes Antimaleware" /fREG ADD %KEY%\017 /V 1 /D "%CDROM%\Software\MALEWAREBYTES.exe" /fREG ADD %KEY%\019 /VE /D "Microsoft Office 2007" /fREG ADD %KEY%\019 /V 1 /D "%CDROM%\Software\O2K7.exe" /fREG ADD %KEY%\021 /VE /D "Silverlight Plugin" /fREG ADD %KEY%\021 /V 1 /D "%CDROM%\Software\Slvrlight.exe" /fREG ADD %KEY%\023 /VE /D "Winamp Media Player" /fREG ADD %KEY%\023 /V 1 /D "%CDROM%\Software\WINAMP.exe" /fREG ADD %KEY%\025 /V 1 /D "regedit /s %CDROM%\upgrade\Apps\copyto.reg" /fREG ADD %KEY%\027 /V 1 /D "regedit /s %CDROM%\upgrade\Apps\moveto.reg" /fREG ADD %KEY%\029 /V 1 /D "regedit /s %CDROM%\upgrade\Apps\Add_Computer_Desktop_Icon_All_Users.reg" /f::CLEAN-UPcd %~dp0attrib -R -A -S -H *.*SHUTDOWN /R /T 5cd..RMDIR /S /Q "%WINDIR%\Setup\Scripts"EXIT

And this is the Directory Structure that I have in my ISO

e9Orw44.jpg

Thanks and Cheers !!

Edited by kingshawn
Link to comment
Share on other sites

Thanks kingshawn, but this only applies to "All Users", some registries (actually many) won't work this way, for example, lock taskbar, or even apply theme, for that you need to run the bat on first logon, and setupcomplete runs before that happens.

Link to comment
Share on other sites

^^ Are you refereing to User Specific themes and tweaks. For Eg. Would you want to see User1 with a specific theme or tweak and User2 with a different theme/tweak ? If you are more clear, I may give it a shot and test.

Dogway, please explain your scenario

Link to comment
Share on other sites

yes, sorry. Actually applying a theme to current user. After several attempts Tripredacus suggested to apply it (theme) through a bat command, however this should be applied at a user level, only after being logged, that is or supposed to be after setupcomplete.cmd. There were many other registry entries that weren't applied either because presumably the same reasons.

I learned that there are very limited things that can be done with setupcomplete.cmd, they all are related to local machine, at a global scope.

And now that I realise, what you are actually doing through setupcomplete is not run anything at all, but write onto RunOnceEX the commands that will be executed upon logon. That makes it a 4th variant. Looks like write onto RunOnceEX reg is the only real way, with different approaches on how to "write" it only.

Check if you can run these:

regsvr32 /u /s wmpshell.dll"%windir%\Resources\Themes\whatever is your theme.theme"; Hide Action Center Icon on taskbar[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]"HideSCAHealth"=dword:00000001"NoCDBurning"=dword:00000001; Lock taskbar[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced]"TaskbarSizeMove"=dword:00000000; Disable Tool Tips"ShowInfoTip"=dword:00000000; Quality of thumbnail view mode preview and size[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer]"ThumbnailQuality"=dword:00000032"ThumbnailSize"=dword:00000064

Reg's on a file apart. Those entries are the ones that I had trouble to get applied, I'm unaware of others.

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