Jump to content

AutoRun Script Post Windows Install


Recommended Posts

Hey,

I currently have setupcomplete.cmd executing the following code...

@echo off
TITLE Finalizing Setup Stage
cmdow.exe @ /DIS /TOP
ECHO !! !!
ECHO !! !!
ECHO !! DO NOT CLOSE THIS WINDOW !!
ECHO !! !!
ECHO !! !!
ECHO.
ECHO Installing Boot Manager Grub, Please wait...
ECHO.
for %%A 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 %%A\bootmgr (
if not exist %%A\setup.exe (
echo.
echo Installing to drive %%A
echo.
if exist %%A\menu.lst attrib %%A\menu.lst -h -r -s
if exist %%A\menu.lst ren %%A\menu.lst menu_lst.bak
if exist %%A\grldr attrib %%A\grldr -h -r -s
copy %systemroot%\setup\scripts\grldr %%A\grldr
attrib %%A\grldr +h +s +r
%systemroot%\setup\scripts\bootinst /nt60 %%A
)
)
)
EHCO.
ECHO.
ECHO Installing Windows Post Installer, please wait...
ECHO.
ECHO STEP 1: PREPARING TO COPY FILES
ECHO.
ECHO Preparing to copy files...
ECHO Please wait...

:makedir
ECHO.
ECHO STEP 2: CREATING DIRECTORY STRUCTURE
ECHO.
ECHO Directory Structure Being Created...
md %SYSTEMDRIVE%\WPI_Applications
IF ERRORLEVEL 1 GOTO retry
ECHO Done!
ECHO.
ECHO STEP 3: COPYING DIRECTORYS AND FILES
ECHO.
xcopy "%CD%\WPI" "%SYSTEMDRIVE%\WPI_Applications" /e /f /y /c /v
IF ERRORLEVEL 1 GOTO error

ECHO.
ECHO Verifying...
ECHO.
cd %SYSTEMDRIVE%\WPI_Applications
dir /s /b
ECHO.
ECHO File Transfer Complete...
ECHO.
ECHO Performing cleanup steps...
ECHO Removing temp files...
cd %windir%\Setup\SCRIPTS
del WPI /F /Q
rd WPI
ECHO Now executing Windows Post Installer, then Exiting script...
Start %systemdrive%\WPI_Applications\WPI.hta
ECHO Goodbye!
pause
exit /B

:error
ECHO.
ECHO File Transfer Failed!
ECHO You will not be able to run WPI Applications from your HDD later
ECHO You will instead require this install DVD
ECHO Now exiting...
ECHO Goodbye!
pause
exit /B

:retry
ECHO.
ECHO ERROR STEP 1: REMOVING PRIOR DIRECTORY STRUCTURE
ECHO.
ECHO Removing directory and contents...
rd %SYSTEMDRIVE%\WPI_Applications /s /q
IF NOT ERRORLEVEL 1 GOTO exit
ECHO Done!
ECHO Retrying Directory Structure Creation...
GOTO makedir

:exit
ECHO An error occured that this script could not correct
ECHO You will not be able to run WPI Applications from your HDD later
ECHO You will instead require this install DVD
ECHO Or instead you can try a manual copy
ECHO Now exiting...
ECHO Goodbye!
pause
exit /B

Problem with that is their is no visual with this happening, so it gives the impression the installation has hung, and users, including myself until i researched setupcomplete.cmd, forcefully restarted the computer.

The reason it gives the impression installation has hung is because it copies 3GB worth of applications which naturally takes a long time.

I'm after a script that will allow the above code to run after the user has logged on.

I read about firstlogon but I don't have that file.

The windows files I am using is an image of my recovery partition, so the only files I have are as follows...

dell.xml

first.cmd

oobe.cmd

system.cmd

setupcomplete.cmd

Dell.xm appears to be firstlogon, but im not to sure, this is its contents...

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="oobeSystem">
<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">
<OEMInformation>
<Manufacturer></Manufacturer>
<Logo>c:\windows\system32\oobe\dell_badge.bmp</Logo>
</OEMInformation>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>c:\windows\setup\scripts\first.cmd</CommandLine>
<Description>first boot command file</Description>
<Order>1</Order>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
<cpi:offlineImage cpi:source="wim:c:/work/sources/install.wim#Windows Vista ULTIMATE" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>

Would I be correct in saying, If i want a script to execute at the first logon of a user, that I would moddify the first.cmd file to suit my needs?

Further, would that mean that first.cmd runs once with EACH user, or just a single user.

Because of what the script does, It can only run once on the system.

It copies a directory and its contents, removes the original directory, executes wpi.hta which then installs applications

If that was to happen with every user it would error out an aweful lot and just look silly.

Basically, I need my script to run once only but after setup (Say when the desktop has loaded), or any other time where there can be a visual of the process taking place

Link to comment
Share on other sites


BEFORE I added things to it to test, nothing.

About an hour ago I added my script to it to test, so at the moment, it contains the following...

@echo off
TITLE Finalizing Setup Stage
cmdow.exe @ /DIS /TOP
ECHO !! !!
ECHO !! !!
ECHO !! DO NOT CLOSE THIS WINDOW !!
ECHO !! !!
ECHO !! !!
EHCO.
ECHO.
ECHO Installing Windows Post Installer, please wait...
ECHO.
ECHO STEP 1: PREPARING TO COPY FILES
ECHO.
ECHO Preparing to copy files...
ECHO Please wait...

:makedir
ECHO.
ECHO STEP 2: CREATING DIRECTORY STRUCTURE
ECHO.
ECHO Directory Structure Being Created...
md %SYSTEMDRIVE%\WPI_Applications
IF ERRORLEVEL 1 GOTO retry
ECHO Done!
ECHO.
ECHO STEP 3: COPYING DIRECTORYS AND FILES
ECHO.
xcopy "%CD%\WPI" "%SYSTEMDRIVE%\WPI_Applications" /e /f /y /c /v
IF ERRORLEVEL 1 GOTO error

ECHO.
ECHO Verifying...
ECHO.
cd %SYSTEMDRIVE%\WPI_Applications
dir /s /b
ECHO.
ECHO File Transfer Complete...
ECHO.
ECHO Performing cleanup steps...
ECHO Removing temp files...
cd %windir%\Setup\SCRIPTS
del WPI /F /Q
rd WPI
ECHO Now executing Windows Post Installer, then Exiting script...
Start %systemdrive%\WPI_Applications\WPI.hta
ECHO Goodbye!
pause
exit /B

:error
ECHO.
ECHO File Transfer Failed!
ECHO You will not be able to run WPI Applications from your HDD later
ECHO You will instead require this install DVD
ECHO Now exiting...
ECHO Goodbye!
pause
exit /B

:retry
ECHO.
ECHO ERROR STEP 1: REMOVING PRIOR DIRECTORY STRUCTURE
ECHO.
ECHO Removing directory and contents...
rd %SYSTEMDRIVE%\WPI_Applications /s /q
IF NOT ERRORLEVEL 1 GOTO exit
ECHO Done!
ECHO Retrying Directory Structure Creation...
GOTO makedir

:exit
ECHO An error occured that this script could not correct
ECHO You will not be able to run WPI Applications from your HDD later
ECHO You will instead require this install DVD
ECHO Or instead you can try a manual copy
ECHO Now exiting...
ECHO Goodbye!
pause
exit /B

Google isn't really helping me learn what first.cmd does, or the other cmd files in the scripts directory

Link to comment
Share on other sites

Sure have, believe it or not I'm making the entire process easier.

WPI won't launch from the disk, and the people in the WPI forums are stumpped as to why.

So its turned out easier to copy the contents to disk first, then launching the installer that way.

So back to my question, which script is post UA?

I'm assuming first.cmd?

Link to comment
Share on other sites

Normally in firstlogon.cmd but could be referred to as first.cmd

This is how I start WPI from UA

<SynchronousCommand wcm:action="add">
<CommandLine>%AppsRoot%WPI\WPI.hta</CommandLine>
<Description>WPI Application Installer</Description>
<Order>120</Order>
</SynchronousCommand>

As for shortcuts & cleaning up I do this in WPI.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...