Skip to content
View in the app

A better way to browse. Learn more.

MSFN

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How come FirstLogonCommand is not working?

Featured Replies

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

'%InstalDrive%' is not recognized as an internal or external command,

operable program or batch file.

%systemdrive%\Install

  • Author
'%InstalDrive%' is not recognized as an internal or external command,

operable program or batch file.

%systemdrive%\Install

Ahh... I somehow have missed that. I'll try again and see what happen. Thanks.

Kenneth

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.

  • Author

Thanks Skauneboy. After correcting that mistakes, everything works now. Now, if I can import the registry tweaks into the default profile.

Any suggestions?

Kenneth

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.

  • 1 year later...

Save starting a new thread, how can I start a command following the last reboot? I presently use setupcomplete.cmd but finds halts the desktop setup until the reboot?

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.