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

RunOnceEx failing on Windows 7 SP1

Windows 7 SP1 RunOnceEx

  • Please log in to reply
18 replies to this topic

#1
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag

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 off

FOR %%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\RunOnceEx
SET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%\001 /VE /D "7 Zip" /f
REG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\7ZIP.exe" /f

REG ADD %KEY%\003 /VE /D "Acrobat Reader" /f
REG ADD %KEY%\003 /V 1 /D "%CDROM%\Software\ACROBAT.exe" /f

REG ADD %KEY%\005 /VE /D "CD BurnerXP" /f
REG ADD %KEY%\005 /V 1 /D "%CDROM%\Software\CDBURNER.exe" /f

REG ADD %KEY%\007 /VE /D "Mozilla Firefox" /f
REG ADD %KEY%\007 /V 1 /D "%CDROM%\Software\FIREFOX.exe" /f

REG ADD %KEY%\009 /VE /D "FLASH ACTIVEX" /f
REG ADD %KEY%\009 /V 1 /D "%CDROM%\Software\FLASHAX.exe" /f

REG ADD %KEY%\011 /VE /D "FLASH PLUG-in" /f
REG ADD %KEY%\011 /V 1 /D "%CDROM%\Software\FLASHPLUGIN.exe" /f

REG ADD %KEY%\013 /VE /D "Google Chrome" /f
REG ADD %KEY%\013 /V 1 /D "%CDROM%\Software\GOOGLECHROME.exe" /f

REG ADD %KEY%\015 /VE /D "KLite Media Pack" /f
REG ADD %KEY%\015 /V 1 /D "%CDROM%\Software\KLITE.exe" /f

REG ADD %KEY%\017 /VE /D "Maleware Bytes Antimaleware" /f
REG ADD %KEY%\017 /V 1 /D "%CDROM%\Software\MALEWAREBYTES.exe" /f

REG ADD %KEY%\019 /VE /D "Microsoft Office 2007" /f
REG ADD %KEY%\019 /V 1 /D "%CDROM%\Software\O2K7.exe" /f

REG ADD %KEY%\021 /VE /D "Silverlight Plugin" /f
REG ADD %KEY%\021 /V 1 /D "%CDROM%\Software\Slvrlight.exe" /f


REG ADD %KEY%\023 /VE /D "Winamp Media Player" /f
REG ADD %KEY%\023 /V 1 /D "%CDROM%\Software\WINAMP.exe" /f

::CLEAN-UP

attrib -R -A -S -H *.*
SHUTDOWN /R /T 5
cd..
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 

 




How to remove advertisement from MSFN

#2
maxXPsoft

maxXPsoft

    MSFN Master

  • Developer
  • 2,889 posts
  • Joined 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

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, 10 December 2013 - 02:33 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

#3
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag

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.


#4
maxXPsoft

maxXPsoft

    MSFN Master

  • Developer
  • 2,889 posts
  • Joined 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Your FOR %%i IN should work as its same as this in xml http://www.msfn.org/...-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, 10 December 2013 - 10:29 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

#5
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag
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?

#6
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag
For Windows xp I followed this guide http://unattended.ms...xp/view/web/59/

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

#7
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,970 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

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.


MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
tpxmsfn1_zps393339c1.jpg

#8
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 392 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

For Windows xp I followed this guide http://unattended.ms...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.



#9
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 392 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

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>


#10
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag

Issue resolved finally I was able to achieve what I wanted. will upload a tutorial soon



#11
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 392 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

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.



#12
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag

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 off

FOR %%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\RunOnceEx
SET KEY=HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%\001 /VE /D "7 Zip" /f
REG ADD %KEY%\001 /V 1 /D "%CDROM%\Software\7ZIP.exe" /f

REG ADD %KEY%\003 /VE /D "Acrobat Reader" /f
REG ADD %KEY%\003 /V 1 /D "%CDROM%\Software\ACROBAT.exe" /f

REG ADD %KEY%\005 /VE /D "CD BurnerXP" /f
REG ADD %KEY%\005 /V 1 /D "%CDROM%\Software\CDBURNER.exe" /f

REG ADD %KEY%\007 /VE /D "Mozilla Firefox" /f
REG ADD %KEY%\007 /V 1 /D "%CDROM%\Software\FIREFOX.exe" /f

REG ADD %KEY%\009 /VE /D "FLASH ACTIVEX" /f
REG ADD %KEY%\009 /V 1 /D "%CDROM%\Software\FLASHAX.exe" /f

REG ADD %KEY%\011 /VE /D "FLASH PLUG-in" /f
REG ADD %KEY%\011 /V 1 /D "%CDROM%\Software\FLASHPLUGIN.exe" /f

REG ADD %KEY%\013 /VE /D "Google Chrome" /f
REG ADD %KEY%\013 /V 1 /D "%CDROM%\Software\GOOGLECHROME.exe" /f

REG ADD %KEY%\015 /VE /D "KLite Media Pack" /f
REG ADD %KEY%\015 /V 1 /D "%CDROM%\Software\KLITE.exe" /f

REG ADD %KEY%\017 /VE /D "Maleware Bytes Antimaleware" /f
REG ADD %KEY%\017 /V 1 /D "%CDROM%\Software\MALEWAREBYTES.exe" /f

REG ADD %KEY%\019 /VE /D "Microsoft Office 2007" /f
REG ADD %KEY%\019 /V 1 /D "%CDROM%\Software\O2K7.exe" /f

REG ADD %KEY%\021 /VE /D "Silverlight Plugin" /f
REG ADD %KEY%\021 /V 1 /D "%CDROM%\Software\Slvrlight.exe" /f

REG ADD %KEY%\023 /VE /D "Winamp Media Player" /f
REG ADD %KEY%\023 /V 1 /D "%CDROM%\Software\WINAMP.exe" /f

REG ADD %KEY%\025 /V 1 /D "regedit /s %CDROM%\upgrade\Apps\copyto.reg" /f
REG ADD %KEY%\027 /V 1 /D "regedit /s %CDROM%\upgrade\Apps\moveto.reg" /f
REG ADD %KEY%\029 /V 1 /D "regedit /s %CDROM%\upgrade\Apps\Add_Computer_Desktop_Icon_All_Users.reg" /f

::CLEAN-UP
cd %~dp0
attrib -R -A -S -H *.*
SHUTDOWN /R /T 5
cd..
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, 15 December 2013 - 10:14 AM.


#13
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 392 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

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.



#14
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag

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



#15
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 392 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

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.



#16
kingshawn

kingshawn

    Newbie

  • Member
  • 10 posts
  • Joined 09-December 13
  • OS:Vista Ultimate x86
  • Country: Country Flag

I will try these and post back



#17
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 392 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

While I wait your test I wonder, wouldn't it be possible to just:

REG ADD %KEY%\001 /V 1 /D "%CDROM%\RunOnce.cmd" /f


#18
Dogway

Dogway

    Advanced Member

  • Member
  • PipPipPip
  • 392 posts
  • Joined 24-December 11
  • OS:XP Pro x86
  • Country: Country Flag

Just tested and didn't work either. There's no frigging way to run a batch file under a user logon from unattended...

 

edit: guess I found a way, I will try that.

 

edit2: worked like charm finally, thanks for the no-help  : P


Edited by Dogway, 25 December 2013 - 12:31 PM.


#19
Harshad

Harshad
  • Member
  • 6 posts
  • Joined 14-December 11
  • OS:Windows 7 x64
  • Country: Country Flag

I have to build a Win7 setup for a friend.
Its been over a year since my last build. So followed this old post of mine - http://www.msfn.org/...-dvd/?p=1039263

 

And even kingshawn's #12 - http://www.msfn.org/...1/#entry1063027

 

For testing I kept my SETUPCOMPLETE.CMD small and also followed the directory structure.

<disc_root>\sources\$OEM$\$$\SETUP\SCRIPTS\SETUPCOMPLETE.CMD
<disc_root>\Apps

FOR %%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:
echo %CDROM%


REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx


REG ADD %KEY% /V TITLE /D "Removing Setup Disc Will Cancel Installation." /f

REG ADD %KEY%\001 /VE /D "Drivers" /f
REG ADD %KEY%\001 /V 1 /D "%CDROM%\Apps\Drivers\DP_Install_Tool.cmd /K" /f

REG ADD %KEY%\002 /VE /D "WinRAR 5.20 Beta 3" /f
REG ADD %KEY%\002 /V 1 /D "%CDROM%\Apps\Drivers\SFX_WinRAR_AIO_5.2b-3.exe" /f

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

%~dp0"Program.exe" /silent
::CLEAN-UP
cd %~dp0
attrib -R -A -S -H *.*
SHUTDOWN /R /T 5
cd..
RMDIR /S /Q "%WINDIR%\Setup\Scripts"

EXIT

The problem. Drivers and WinRAR is not getting installed. WinRAR is a switchless installer - [http://www.wincert.n...x-addon-maker/]

 

Program.exe is executed so I know that SETUPCOMPLETE.CMD is executing. Don't know why the installation is not happening. Checked the SETUPCOMPLETE.CMD seperately on my host machine with the OS already installed. Put the SETUPCOMPLETE.CMD on the desktop along with the programs to be executed. The entries were added to the registry and executed on restart too.

 

My test environment is VMWare Player.

Please help.


Edited by Harshad, 14 November 2014 - 01:03 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users