Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unattended win7 - firstlogoncommands failing

Status
Not open for further replies.

Leozack

MIS
Oct 25, 2002
867
0
0
GB
OK so after MUCH faffing around with vlite adn rt7lite and unattend.xml generators I have an answerfile which DOESN'T ask for language etc during winpe setup (trying to get it to use en-GB and not ask during winpe setup was crazy) and DOES leave the pc in en-GB (UK) mode.

So now I'm on to the post-setup part - I've tried various runsynchronous and such but what I really want is a batch file from the setup source drive to run and I put my instructions in there. I don't want to ues setupcomplete.cmd method because despite woring perfectly including the installs which are now failing - it runs while the screen says "testing video performance" or whatever it is, and I don't want it running then, I'd prefer it while the setup shows "completing setup" or during logon - hence using firstlogoncommands.

So my autounattend.xml now has a firstlogoncommand pointing to a FirstRun.cmd in windows\setup\scripts which is copied there from $OEM$ on the source media. This works and fires the firstrun.cmd which checks the drivelist for the installdrive and runs [installdrive]\FirstRun\FirstRun.bat - all good so far.

I've checked via writing to c:\Setuplog.txt during the FirstRun.bat and the script IS running all the way down. But it's not doing the important tasks in the script even though it runs right through! The script DOES manage to delete the xml from windows\panther and DOES manage to delete the script files from windows\setup\scripts but it DOESN'T run the dotnet4 install /quiet /norestart which it should and DOESN'T succeed in running a regfile which has tweaks in it.Is there a reason firstlogon can't install dotnet4 or merge a regfile? I repeat - the script definately runs right to the end. And I'm SURE it was working last night at some point during tests.

Is this a problem with credentials that firstlogoncommands runs under? Setup is set to autologon admin once so it should run udner this if anything. And can anyone confirm what is onscreen when firstlogoncommands is running? My batchfile never appears which is used to with runonceex on XP deployments.

Below is my FirstRun.cmd in %windir%\system\scripts
Code:
@echo off
echo %date% %time% Firstrun.cmd >> c:\Setuplog.txt

cls
color 2a

for %%i in (b: 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 %%i\FirstRun\FirstRun.bat %%i\FirstRun\FirstRun.bat

Below is my Firstrun.bat which FirstRun.cmd calls once it inds the install device
Code:
@echo off
echo %date% %time% Firstrun.bat >> c:\Setuplog.txt

REM Called from %windir%\Setup\Scripts\FirstRun.cmd
REM Which is copied from [InstallDrive]\sources\$OEM$\$$\Setup\Scripts\FirstRun.cmd

echo              Installing .NET 4 ...
echo.

echo %date% %time% Before dotnet4 >> c:\Setuplog.txt

dotNetFx40_Full_x86_x64.exe /Quiet /NoRestart

echo              Running reg edits ...
echo.

echo %date% %time% Before REG >> c:\Setuplog.txt

regedit /s WIN7IE89WMP11.REG

echo              Removing sysprep files ...
echo.

del /Q /F %WINDIR%\system32\sysprep\unattend.xml
del /Q /F %WINDIR%\panther\unattend.xml
del /Q /F %WINDIR%\Setup\Scripts\SetupComplete.bak.cmd
del /Q /F %WINDIR%\Setup\Scripts\SetupComplete.cmd
del /Q /F %WINDIR%\Setup\Scripts\FirstRun.cmd

echo %date% %time% Before reboot >> c:\Setuplog.txt

echo              Now rebooting ...

ping 127.0.0.1 -n 10 > nul

shutdown -r -t 0

Below is my xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
  <settings pass="windowsPE">
    <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="[URL unfurl="true"]http://schemas.microsoft.com/WMIConfig/2002/State"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance">[/URL]
      <SetupUILanguage>
        <UILanguage>en-US</UILanguage>
      </SetupUILanguage>
      <InputLocale>0809:00000809</InputLocale>
      <UserLocale>en-GB</UserLocale>
      <UILanguage>en-US</UILanguage>
      <SystemLocale>en-GB</SystemLocale>
    </component>
    <component name="Microsoft-Windows-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="[URL unfurl="true"]http://schemas.microsoft.com/WMIConfig/2002/State"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance">[/URL]
      <ImageInstall>
        <OSImage>
          <InstallFrom>
            <MetaData wcm:action="add">
              <Key>/IMAGE/NAME</Key>
              <Value>Windows 7 PROFESSIONAL</Value>
            </MetaData>
          </InstallFrom>
          <InstallToAvailablePartition>false</InstallToAvailablePartition>
          <WillShowUI>OnError</WillShowUI>
        </OSImage>
      </ImageInstall>
      <UserData>
        <ProductKey>
          <Key></Key>
          <WillShowUI>OnError</WillShowUI>
        </ProductKey>
        <Organization>ORG</Organization>
        <FullName>NAME</FullName>
        <AcceptEula>true</AcceptEula>
      </UserData>
    </component>
    </settings>
  <settings pass="oobeSystem">
    <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="[URL unfurl="true"]http://schemas.microsoft.com/WMIConfig/2002/State"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance">[/URL]
      <OOBE>
        <HideEULAPage>true</HideEULAPage>
        <NetworkLocation>Work</NetworkLocation>
        <ProtectYourPC>3</ProtectYourPC>
        <SkipMachineOOBE>true</SkipMachineOOBE>
        <SkipUserOOBE>true</SkipUserOOBE>
      </OOBE>
      <UserAccounts>
        <AdministratorPassword>
          <Value>password</Value>
        </AdministratorPassword>
      </UserAccounts>
      <AutoLogon>
        <Password>
          <Value>password</Value>
        </Password>
        <Enabled>true</Enabled>
        <LogonCount>1</LogonCount>
        <Username>Administrator</Username>
      </AutoLogon>
      <FirstLogonCommands>
        <SynchronousCommand wcm:action="add">
          <Order>1</Order>
          <Description>Run FirstRun.cmd</Description>
          <CommandLine>%WINDIR%\Setup\Scripts\FirstRun.cmd</CommandLine>
        </SynchronousCommand>
      </FirstLogonCommands>
    </component>
  </settings>
  <settings pass="specialize">
    <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="[URL unfurl="true"]http://schemas.microsoft.com/WMIConfig/2002/State"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance">[/URL]
      <ComputerName>Win7SP1</ComputerName>
    </component>
    <component name="Microsoft-Windows-Security-Licensing-SLC-UX" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="NonSxS" xmlns:wcm="[URL unfurl="true"]http://schemas.microsoft.com/WMIConfig/2002/State"[/URL] xmlns:xsi="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema-instance">[/URL]
      <SkipAutoActivation>true</SkipAutoActivation>
    </component>
  </settings>
  <cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

_________________________________
Leozack
Code:
MakeUniverse($infinity,1,42);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top