Jump to content

How come FirstLogonCommand is not working?


Recommended Posts

Hi,

I created a basic autounattend.xml for Windows 7 RC that works fine. But when I wanted to install some applications and some registry tweaks and use the FirstLogonCommands. Windows Setup install fine without any errors find in the setup logs. I tried severals times without any success. Nothing gets install.

Can someone take a look at it and see what I'm doing wrong?

I use this guide from this l

Here my autounattend.xml

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<ProductKey>
<WillShowUI>OnError</WillShowUI>
<Key>GG4MQ-MGK72-HVXFW-KHCRF-KW6KY</Key>
</ProductKey>
<AcceptEula>true</AcceptEula>
</UserData>
<ImageInstall>
<OSImage>
<InstallToAvailablePartition>false</InstallToAvailablePartition>
<WillShowUI>OnError</WillShowUI>
</OSImage>
</ImageInstall>
</component>
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>en-US</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>en-US</InputLocale>
<UILanguage>en-US</UILanguage>
<SystemLocale>en-US</SystemLocale>
<UserLocale>en-US</UserLocale>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Home</NetworkLocation>
<ProtectYourPC>3</ProtectYourPC>
</OOBE>
<TimeZone>Pacific Standard Time</TimeZone>
<AutoLogon>
<Password>
<Value>UABhAHMAcwB3AG8AcgBkAA==</Value>
<PlainText>false</PlainText>
</Password>
<Enabled>true</Enabled>
<LogonCount>1</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>%InstalDrive%\Install\Install.cmd</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%InstalDrive%\Install\Cleanup.cmd</CommandLine>
<Order>2</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%InstalDrive%\Install\Registry_Tweaks\Install.cmd</CommandLine>
<Order>3</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%InstalDrive%\Install\Shutdown.cmd</CommandLine>
<Order>4</Order>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ComputerName>AngelPC</ComputerName>
</component>
<component name="Microsoft-Windows-Deployment" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>cmd /c "FOR %i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %i:\InstallDrive.txt SETX InstallDrive %i:\ -m"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>cmd /c reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f</Path>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:f:/sources/install.wim#Windows 7 ULTIMATE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

I added two RunSynchronousCommand in the specialize pass to set the driver letter for the Install folder and turn off the UAC.

			<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order>
<Path>cmd /c "FOR %i IN (C D E F G H I J K L N M O P Q R S T U V W X Y Z) DO IF EXIST %i:\InstallDrive.txt SETX InstallDrive %i:\ -m"</Path>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Order>2</Order>
<Path>cmd /c reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f</Path>
</RunSynchronousCommand>
</RunSynchronous>

Next, I set the autoogin as follows:

			<AutoLogon>
<Password>
<Value>UABhAHMAcwB3AG8AcgBkAA==</Value>
<PlainText>false</PlainText>
</Password>
<Enabled>true</Enabled>
<LogonCount>1</LogonCount>
<Username>Administrator</Username>
</AutoLogon>

Finally, I add four FirstLogonCommands commands to install applications, import registry, cleanup and shutdown computer.

			<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<Order>1</Order>
<CommandLine>%InstalDrive%Install\Install.cmd</CommandLine>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%InstalDrive%Install\Cleanup.cmd</CommandLine>
<Order>2</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%InstalDrive%Install\Registry_Tweaks\Install.cmd</CommandLine>
<Order>3</Order>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%InstalDrive%Install\Shutdown.cmd</CommandLine>
<Order>4</Order>
</SynchronousCommand>
</FirstLogonCommands>

The Install.cmd looks like this:

CLS
@ECHO OFF

TITLE "INSTALLATION"

REM --------------------------------------------------------
REM APPLICATIONS

ECHO Installing NOTEPAD2
ECHO.
START /WAIT %InstallDrive%\Install\Notepad2\Install_Unattend_Win7.cmd

ECHO VISUAL C++ RUNTIMES
ECHO.
START /WAIT %InstallDrive%\Install\Visual_C_Runtimes\Install_Unattend.cmd

EXIT

Any help would be gratefully appreciated.

Kenneth

Edited by magic12kenneth
Link to comment
Share on other sites


Actually it's easier than that :) You've named the Environment Variable for your source disk to %InstallDrive% but you're calling your FirstLogonCommands from %InstalDrive%. There's an l missing.

Link to comment
Share on other sites

For registry tweaks I'm using (in Vista as well) SetupComplete.cmd inside Windows\Setup\Scripts.

You will need to create the Scripts folder. In SetupComplete.cmd I call extras.cmd which is placed in the root on the wim image and does the registry tweaks, among other things.

Windows will automatically execute it after finishing the setup, just before the last reboot.

Link to comment
Share on other sites

  • 1 year later...

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