Jump to content

Recommended Posts

Posted

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

Result:

rundll32 command did not work in the setupcomplete.cmd

Other commands than rundll32 in the setupcomplete.cmd did work

After installation, I tried the same command and rundll32 successfully worked

I wonder setupcomplete has any limitation.

Any comments would be appreciated.


Posted (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 by MrJinje
Posted (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.inf

BTW 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 by ricktendo64
Posted

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

But 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!!

Posted

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>

Posted

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.

Posted

Setupcomplete.cmd runs right before Load Desktop and can be used to complete Final Steps

Note: Commands in the Setupcomplete.cmd file are executed with local system privilege.

I run exe or msi there but no Reg.

Posted

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.

Posted

I read the following article.

http://blogs.technet.com/deploymentguys/ar...er-2008-r2.aspx

According 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 /f
reg 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,

Posted (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 by MrJinje
Posted
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 WshShell

Set WshShell = WScript.CreateObject("WScript.Shell")

'On Error Resume Next

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

Setup=whatevername.vbs

TempMode

Silent=1

Overwrite=1

The 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

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