Jump to content
MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. ×

Why isn't my FirstLogonCommands cmd file running in setup?


 Share

Recommended Posts

This is driving me nuts as to why my simple run.cmd set to execute during FirstLogonCommands is not running like it should. I moulded my autounattend.xml after bobtheknob's here

After Vista SP1 installs and fails to run the run.cmd, I manually set the runsync command for appsroot and then run the run.cmd and it works flawlessly on the desktop!

Getting these xml's done right is all about syntax and obviously I'm missing something simple. Help please!

 <?xml version="1.0" encoding="utf-8" ?> 
- <unattend xmlns="urn:schemas-microsoft-com:unattend">
- <settings pass="windowsPE">
- <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" 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>
<Key>*******************************</Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
<FullName>Fragbert</FullName>
</UserData>
- <DiskConfiguration>
- <Disk wcm:action="add">
- <CreatePartitions>
- <CreatePartition wcm:action="add">
<Type>Primary</Type>
<Order>1</Order>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
</DiskConfiguration>
- <ImageInstall>
- <OSImage>
- <InstallTo>
<DiskID>0</DiskID>
<PartitionID>1</PartitionID>
</InstallTo>
<InstallToAvailablePartition>false</InstallToAvailablePartition>
<WillShowUI>OnError</WillShowUI>
</OSImage>
</ImageInstall>
</component>
- <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" 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>0409:00000409</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
</settings>
- <settings pass="specialize">
- <component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="amd64" 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-Deployment" processorArchitecture="amd64" 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:\AppsRoot.txt SETX AppsRoot %i: -m"</Path>
<Description>Detection CDROM</Description>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>
- <settings pass="oobeSystem">
- <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <AutoLogon>
- <Password>
<Value>*************************</Value>
<PlainText>false</PlainText>
</Password>
<Enabled>true</Enabled>
<LogonCount>2</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
- <OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Home</NetworkLocation>
<ProtectYourPC>1</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
<TimeZone>Eastern Standard Time</TimeZone>
- <FirstLogonCommands>
- <SynchronousCommand wcm:action="add">
<CommandLine>%AppsRoot%install\run.cmd</CommandLine>
<Description>Install Programs</Description>
<Order>1</Order>
</SynchronousCommand>
</FirstLogonCommands>
<RegisteredOrganization>Owner</RegisteredOrganization>
<RegisteredOwner>Owner</RegisteredOwner>
</component>
- <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" 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>0409:00000409</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:d:/vista/iso/sources/install.wim#Windows Vista ULTIMATE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

My simple test run.cmd running a 7zip 64bit install, and two switchless installers I made for the citrix client and office2007

Echo..........Install 7-zip
start /wait %AppsRoot%install\7-zip\7z465-x64.msi /passive
Echo..........Install Citrix
start /wait %AppsRoot%install\Citrix\ICA.exe
Echo..........Install Office
start /wait %AppsRoot%install\Office\O2K7.EXE
Echo..........Finished
shutdown -r -c "Rebooting To Finish Setup."

Edited by fragbert
Link to comment
Share on other sites


move the AppsRoot cmd <Order>1</Order> to oobeSystem before the run.cmd <Order>2</Order> should cure that.

Nope, nothing changed. End result is a desktop logged in as administrator with nothing else happening.

Here's my current xml with the change you suggested:

  <?xml version="1.0" encoding="utf-8" ?> 
- <unattend xmlns="urn:schemas-microsoft-com:unattend">
- <settings pass="windowsPE">
- <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" 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>
<Key>********************</Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
<AcceptEula>true</AcceptEula>
<FullName>Fragbert</FullName>
</UserData>
- <DiskConfiguration>
- <Disk wcm:action="add">
- <CreatePartitions>
- <CreatePartition wcm:action="add">
<Type>Primary</Type>
<Order>1</Order>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
</DiskConfiguration>
- <ImageInstall>
- <OSImage>
- <InstallTo>
<DiskID>0</DiskID>
<PartitionID>1</PartitionID>
</InstallTo>
<InstallToAvailablePartition>false</InstallToAvailablePartition>
<WillShowUI>OnError</WillShowUI>
</OSImage>
</ImageInstall>
</component>
- <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" 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>0409:00000409</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
</settings>
- <settings pass="specialize">
- <component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="amd64" 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>
</settings>
- <settings pass="oobeSystem">
- <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <AutoLogon>
<Enabled>true</Enabled>
<LogonCount>2</LogonCount>
<Username>Administrator</Username>
</AutoLogon>
- <Display>
<ColorDepth>32</ColorDepth>
<HorizontalResolution>1024</HorizontalResolution>
<VerticalResolution>768</VerticalResolution>
</Display>
- <OOBE>
<HideEULAPage>true</HideEULAPage>
<NetworkLocation>Home</NetworkLocation>
<ProtectYourPC>1</ProtectYourPC>
<SkipMachineOOBE>true</SkipMachineOOBE>
<SkipUserOOBE>true</SkipUserOOBE>
</OOBE>
<TimeZone>Eastern Standard Time</TimeZone>
- <FirstLogonCommands>
- <SynchronousCommand wcm:action="add">
<CommandLine>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:\AppsRoot.txt SETX AppsRoot %i: -m"</CommandLine>
<Description>Detection CDROM</Description>
<Order>1</Order>
</SynchronousCommand>
- <SynchronousCommand wcm:action="add">
<CommandLine>%AppsRoot%install\run.cmd</CommandLine>
<Description>Install Programs</Description>
<Order>2</Order>
</SynchronousCommand>
</FirstLogonCommands>
<RegisteredOrganization>Owner</RegisteredOrganization>
<RegisteredOwner>Owner</RegisteredOwner>
</component>
- <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" 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>0409:00000409</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:d:/vista/iso/sources/install.wim#Windows Vista ULTIMATE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

Edited by fragbert
Link to comment
Share on other sites

%AppsRoot%install\run.cmd

no backslash

%AppsRoot%\install\run.cmd

I also don't use that setx, would have to be installed to system32

Try this in a .cmd file with your dvd inserted with the AppsRoot.txt. I actually look for a Folder on the Dvd that is not present on any other.

FOR %%d IN (c: 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 %%d\Install SET AppsRoot=%%d
SET

Thats 2 lines there, SET is 2nd line

from the Set cmd AppsRoot=e:

Now you can remove the SET cmd

Edited by maxXPsoft
Link to comment
Share on other sites

You have to be careful of the complexity of the first logon commands

also, if the UAC is still on, you will have even more problems

Echo..........Install 7-zip

start /wait %AppsRoot%install\7-zip\7z465-x64.msi /passive

Echo..........Install Citrix

start /wait %AppsRoot%install\Citrix\ICA.exe

Echo..........Install Office

start /wait %AppsRoot%install\Office\O2K7.EXE

Echo..........Finished

shutdown -r -c "Rebooting To Finish Setup."

This is complex? You kidding me?

Also if you'll notice the Administrator account is autologging in, so UAC does not come into play here.

Link to comment
Share on other sites

You have to be careful of the complexity of the first logon commands

also, if the UAC is still on, you will have even more problems

Echo..........Install 7-zip

start /wait %AppsRoot%install\7-zip\7z465-x64.msi /passive

Echo..........Install Citrix

start /wait %AppsRoot%install\Citrix\ICA.exe

Echo..........Install Office

start /wait %AppsRoot%install\Office\O2K7.EXE

Echo..........Finished

shutdown -r -c "Rebooting To Finish Setup."

This is complex? You kidding me?

Also if you'll notice the Administrator account is autologging in, so UAC does not come into play here.

I personally(probably not doing it right) cannot get First logon commands to work in OOBE

The command line parameters kept getting screwed up. So I used a batch file.

Single command, no spaces to get confusing...

post-234222-1235924817_thumb.png

Link to comment
Share on other sites

You have to be careful of the complexity of the first logon commands

also, if the UAC is still on, you will have even more problems

Echo..........Install 7-zip

start /wait %AppsRoot%install\7-zip\7z465-x64.msi /passive

Echo..........Install Citrix

start /wait %AppsRoot%install\Citrix\ICA.exe

Echo..........Install Office

start /wait %AppsRoot%install\Office\O2K7.EXE

Echo..........Finished

shutdown -r -c "Rebooting To Finish Setup."

This is complex? You kidding me?

Also if you'll notice the Administrator account is autologging in, so UAC does not come into play here.

I personally(probably not doing it right) cannot get First logon commands to work in OOBE

The command line parameters kept getting screwed up. So I used a batch file.

Single command, no spaces to get confusing...

post-234222-1235924817_thumb.png

If you were paying attention to this thread, I am doing the same thing (a single script command).

Link to comment
Share on other sites

You have to be careful of the complexity of the first logon commands

also, if the UAC is still on, you will have even more problems

In my Sig FirstLogonCommands

Runs without the UAC

EDIT:

BTW, I mount my image and move Install folder to root of Image so when Image is laid down the Install becomes C:\Install, D:\Install or whatever drive is selected. Thats easiest for me cause I don't have to do the For loop, just call %systemdrive%\Install\any.cmd, reg, vbs

Edited by maxXPsoft
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...