ogatat Posted November 30, 2009 Share Posted November 30, 2009 I tried to run commands using setupcomplete.cmd at the last of Windows 7 installation.[setupcomplete.cmd]rundll32 setupapi,InstallHinfSection DefaultInstall 128 %SystemRoot%\Setup\Scripts\INSTALL.INFResult:rundll32 command did not work in the setupcomplete.cmdOther commands than rundll32 in the setupcomplete.cmd did workAfter installation, I tried the same command and rundll32 successfully workedI wonder setupcomplete has any limitation.Any comments would be appreciated. Link to comment Share on other sites More sharing options...
MrJinje Posted November 30, 2009 Share Posted November 30, 2009 (edited) Dumb question - Since it is an .INF you are trying to install, why not just use DISM /ADD-DRIVER and integrate directly into the WIM ? Then you don't need worry about SetupComplete, it will be part of your image. Edited November 30, 2009 by MrJinje Link to comment Share on other sites More sharing options...
ricktendo Posted November 30, 2009 Share Posted November 30, 2009 (edited) I use INF instead of REG in my setupcomplete.cmd, here is how I call it (you dont need to add DefaultInstall for LaunchINFSection because its called by default):: Tweaks%SYSTEMROOT%\System32\rundll32 advpack.dll,LaunchINFSection %SYSTEMROOT%\Setup\Scripts\Se7enTweaks.infBTW only reason I use advpack.dll,LaunchINFSection is because I use Cleanup=1 to self delete the INF, otherwize I would simply use InfDefaultInstall.exe in System32%SYSTEMROOT%\System32\InfDefaultInstall.exe %SYSTEMROOT%\Setup\Scripts\nameofinf.inf Edited November 30, 2009 by ricktendo64 Link to comment Share on other sites More sharing options...
ogatat Posted December 1, 2009 Author Share Posted December 1, 2009 Thanks for useful commands.Today I noticed "setupapi" also DID work. I missed some registry tweaks after setup completion.Even if I used advpack method, some registry key were not applied with the following:[setupcomplete.cmd]%SYSTEMROOT%\System32\rundll32 advpack.dll,LaunchINFSection %SYSTEMROOT%\Setup\Scripts\install.infBut with the following it works finally.[setupcomplete.cmd]REG ADD "HKLM\Software\Microsoft\Windows\CurrentVersion\Runonce" /V Once /D "%SystemRoot%\system32\rundll32 advpack.dll,LaunchINFSection %SystemRoot%\Setup\Scripts\install.INF"By the way, if I use DISM to import INF file, during setup I think PnP driver only installed...Anyway thanks for help!! Link to comment Share on other sites More sharing options...
ricktendo Posted December 1, 2009 Share Posted December 1, 2009 Yes not all regtweaks work with setupcomplete.cmd, thats why I use FirstLogonCommands to do reg add in my autounattend.xml <SynchronousCommand wcm:action="add"> <CommandLine>reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer /v Link /t REG_BINARY /d 00000000 /f</CommandLine> <Description>Remove '- Shortcut' Suffix from shortcuts</Description> <Order>5</Order> <RequiresUserInput>false</RequiresUserInput> </SynchronousCommand> Link to comment Share on other sites More sharing options...
ogatat Posted December 1, 2009 Author Share Posted December 1, 2009 Are you checking all registry tweaks are applied or not after finishing installation, then regarding registry tweaks do you use both "firstlogoncommands" and "setupcomplete.cmd" (and INF file)? I wonder if I can find out in advance which registry keys are OK or NG. Link to comment Share on other sites More sharing options...
maxXPsoft Posted December 1, 2009 Share Posted December 1, 2009 Setupcomplete.cmd runs right before Load Desktop and can be used to complete Final StepsNote: Commands in the Setupcomplete.cmd file are executed with local system privilege.I run exe or msi there but no Reg. Link to comment Share on other sites More sharing options...
MrJinje Posted December 1, 2009 Share Posted December 1, 2009 HKLM reg settings are fine from SetupComplete.cmd - I have a number of environment reg settings I push to each machine at this phase. I also force reboot before first login, so that these settings are available on first login (remove pagefile, etc..)HKCU settings do not work as the user account is not active until after first login. (roughly 10 seconds after setupcomplete finishes).I have not tested the <COPYPROFILE> setting within AutoUnattend.xml yet to determine if we can capture HKCU settings into the default user NTUSER.DAT yet. Wording in the .CHM is vague and I'm not sure at which stage during installation the profile is copied. Link to comment Share on other sites More sharing options...
ogatat Posted December 3, 2009 Author Share Posted December 3, 2009 I read the following article.http://blogs.technet.com/deploymentguys/ar...er-2008-r2.aspxAccording to method "C." in the above article, I tired with bellow "setupcomplete.cmd" for HKCU key.[setupcomplete.cmd - sample]reg load "HKU\DefaultUser" "c:\users\Default\ntuser.dat"reg add "HKU\DefaultUser\Control Panel\Desktop" /v PaintDesktopVersion /t reg_dword /d 1 /freg unload "HKU\DefaultUser"It seems "PaintDesktopVersion" did work without reboot.I don't yet try with "firstlogoncommnads".How about this method for HKCU keys?Thanks, Link to comment Share on other sites More sharing options...
MrJinje Posted December 3, 2009 Share Posted December 3, 2009 (edited) How about this method for HKCU keys?FYI, you are changing HKCU keys, the confusion is these keys are not named HKCU until the "Current User" is logged in. So mission accomplished, at least in theory.For future readers, if someone wanted to make the changes permanent, they could mount their WIM with DISM (to C:\Mount in my example), and modify the ntuser.dat offline. Just change the reg load command to point to the mount directory. reg load "HKU\DefaultUser" "c:\Mount\users\Default\ntuser.dat"Question: Anyone know of a program that can take a .REG file and convert it to reg.exe compatible script ? Edited December 3, 2009 by MrJinje Link to comment Share on other sites More sharing options...
Gandalf50 Posted December 7, 2009 Share Posted December 7, 2009 How about this method for HKCU keys?FYI, you are changing HKCU keys, the confusion is these keys are not named HKCU until the "Current User" is logged in. So mission accomplished, at least in theory.For future readers, if someone wanted to make the changes permanent, they could mount their WIM with DISM (to C:\Mount in my example), and modify the ntuser.dat offline. Just change the reg load command to point to the mount directory. reg load "HKU\DefaultUser" "c:\Mount\users\Default\ntuser.dat"Question: Anyone know of a program that can take a .REG file and convert it to reg.exe compatible script ?If I understand correctly you are looking to run a .reg file so you are not prompted to import the file into the registry and it runs silently.I do this by using winrar. I create a vbs script to silently run the reg file like below-----------------------------------------dim WshShellSet WshShell = WScript.CreateObject("WScript.Shell")'On Error Resume NextwShshell.Run "regedit /s yourregfilehere.reg" -------------------------------------------I then package this script and the .reg file into winwar as an sfx and add the sfx commands below;The comment below contains SFX script commandsSetup=whatevername.vbsTempModeSilent=1Overwrite=1The resulting sfx winwar pakage will be saved as an .exe and can be pushed out to run the reg file silently.I can attach an example if I havent misunderstood your question~G Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now