Jump to content

Recommended Posts

Posted

Hi folks,

I've been refining my Seteq XP Builder for some weeks, and have recently come across the SCHTASKS command-line app built into XP Pro. I'd like to use it to insert some self-maintenance tasks into my builds, but it's being stubborn.

Background: I'm not an advanced scripter like gosh, Aaron, and others, but I think I've come up with a cool way to create an unattended installer on 1 CD. I've created a fully scripted installer for XP SP1 plus numerous patches, Office XP Pro SP3 Admin Install, VB6 SP5, Norton SW, Nero 6, Winamp 5.02, 3 Anti-Spyware tools, Quicktime 6.5, Google Toolbar, TightVNC, Acrobat Reader 5.1, WinZip, plus 86MB of device drivers - all on one bootable CD. Uncompressed, the software totals about 1.18GB.

I can accomplish this by assuming that the target PC has two FAT32 partitions, with a D: at least 1.5GB in size. I decompress a 700MB RAR solid archive in DOS to D:, then run all installers from D: (so I kick out the CD when the install cycle starts and the PC can reboot properly when needed).

I use a POSTXP.CMD file which I launch from GUIRunOnce. Yes, it's not pretty but it's a standard command-line which is all this beginner can manage. At the end of the install sequence, there are a few things I need to do, including:

  • Convert the C: drive to NTFS
  • Add Scheduled Tasks to auto-defrag and other maintenance duties

The first I'm still researching, but the second can be accomplished with .XP's built-in SCHTASKS utility, which can be configured via CLI from script.

The Problem: The defrag task can successfully be created with the following:

SCHTASKS /create /TN "Defragment Hard Disk" /TR c:\windows\batfiles\defrag.vbs /SC weekly /ST 17:00:00 /RU system

But that job won't run. If I have to define a system name, user and password (if you define 1, you have to define all 3), then I run into problems because my WINNT.SIF defines * as the ComputerName (so if I have to build several PCs on the same network, the names will all be different). Even if I try to define a static computer name (e.g., PC), and I have a static user and password (XPUser, xpuser), the resulting command would be this:

SCHTASKS /create /TN "Defragment Hard Disk" /TR c:\windows\batfiles\defrag.vbs /SC weekly /ST 17:00:00 /S PC /U XPUser /P xpuser

but SCHTASKS doesn't like that either. It bounces back a message: ERROR: passing the user credential on local connection. I KNOW this is the correct system name, user name, and password, because I set it myself.

Augh! Does anyone else use this, and if so, what parameters have worked for you in unattended scripts?

Thanks, oh and if anyone can tell me how to convert my c: drive to NTFS during the install process, that would be cool too. :)

JP

PS: Here's my POSTXP.CMD install script, for reference:

@echo off
SETLOCAL
SET A=d:\Install\Apps
SET I=d:\Install
SET P=start menu\Programs
SET U=start menu\Utilities
CLS
IF NOT EXIST %I%\Addons\nul (
@ECHO.
@ECHO Extracting Addons ...
@start /min /high /wait %A%\UnRAR.exe x -o+ %I%\Addons.rar %I%\
@DEL %I%\Addons.rar
)
FOR %%R IN (Norton QuickTim Reader51 CDex OfficeXP Spyware1 Spyware2) DO (
IF NOT EXIST %A%\%%R\nul (
@ECHO.
@ECHO Extracting %%R.rar ...
@start /min /high /wait %A%\UnRAR.exe x -o+ %A%\%%R.rar %A%\
@DEL %A%\%%R.rar)
)
ECHO.
ECHO Installing Office XP ...
start /high /wait %A%\OfficeXP\setup.exe TRANSFORMS=%A%\OfficeXP\Unattend.MST /qb-
ECHO.
ECHO Installing TightVNC ...
start /high /wait %A%\TightVNC.exe /sp- /verysilent
ECHO.
ECHO Installing Ad-Aware 6 (Anti-Spyware tool) ...
start /high /wait %A%\AdAware\AdAware6.exe /s
xcopy %A%\AdAware\reflist.ref "%ProgramFiles%\Lavasoft\Ad-Aware 6\" /Q /S /C /E /R /Y
ECHO.
ECHO Installing Nero 6 Ultra CD Burning software ...
start /wait REGEDIT /S %A%\Nero6.reg
start /high /wait %A%\Nero6303.exe /SILENT /NOREBOOT /SN=[deleted] /WRITE_SN
ECHO.
ECHO Installing Norton SystemWorks ...
start /high /wait %A%\Norton\NSW.msi /QB
ECHO.
ECHO Installing QuickTime 6.5 ...
start /high /wait %A%\QuickTim\QT65Full.exe
ECHO.
ECHO Installing Visual Basic 6 Runtimes ...
start /high /wait %A%\VB6SP5.exe /Q
ECHO.
ECHO Applying MDAC Hotfix ...
start /high /wait %I%\WinXP\I386\Update\Q832483.exe /C:"dahotfix.exe /q /n" /q
ECHO.
ECHO Applying Media Player Hotfix ...
start /high /wait %I%\WinXP\I386\Update\Q817787.exe /Q:A /R:N
ECHO.
ECHO Installing Adobe Acrobat Reader ...
start /high /wait %A%\Reader51\Setup.exe /S /F1"%A%\Reader51\Setup.iss"
ECHO.
ECHO Installing Google Toolbar ...
start /high /wait %A%\Google.exe /q
ECHO.
ECHO Installing My IP Address ...
start /high /wait %A%\myipss10.exe /silent /noreboot
ECHO.
ECHO Installing WinAmp 5.02 ...
start /high /wait %A%\WinAmp5\WinAmp.msi /QB
taskkill /IM winamp.exe /F
taskkill /IM winampa.exe /F
xcopy %A%\WinAmp5\WinAmp.ini "%ProgramFiles%\Winamp\winamp.ini" /Q /S /C /E /R /Y
xcopy %A%\WinAmp5\gen_ml.ini "%ProgramFiles%\Winamp\Plugins\gen_ml.ini" /Q /S /C /E /R /Y
ECHO.
ECHO Installing Spyware Blaster ...
start /high /wait %A%\Spyware1\Spyware1.exe /verysilent /SP-
taskkill /IM spywareblaster.exe /F
xcopy %A%\Spyware1\*.dtb "%ProgramFiles%\SpywareBlaster\*.dtb" /Q /S /C /E /R /Y
ECHO.
ECHO Installing Spyware Guard ...
start /high /wait %A%\Spyware2\Spyware2.exe /silent
taskkill /IM sgmain.exe /F
taskkill /IM sgbhp.exe /F
xcopy %A%\Spyware2\*.dtb "%ProgramFiles%\SpywareGuard\*.dtb" /Q /S /C /E /R /Y
ECHO.
ECHO Applying Global registry tweaks ...
start /high /wait REGEDIT /S %I%\WinXP\$OEM$\XPTweaks.reg
ECHO.
ECHO Applying User registry tweaks ...
start /high /wait REGEDIT /S %I%\WinXP\$OEM$\user.reg
ECHO.
ECHO Applying Spyware Blocking definitions to IE ...
start /high /wait REGEDIT /S %I%\WinXP\$OEM$\spyblock.reg
ECHO.
ECHO Creating Backup folder on D: Drive ...
IF NOT EXIST d:\backup\nul (@md d:\Backup)
xcopy %windir%\batfiles\*.txt d:\Backup /Q /S /C /E /R /Y
ECHO.
ECHO Cleaning up Start Menu items ...
MD "%allusersprofile%\%U%\Nero"
xcopy "%allusersprofile%\%P%\Nero\*.*" "%allusersprofile%\%U%\Nero\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\Nero" /S /Q
ECHO.
MD "%allusersprofile%\%U%\TightVNC"
xcopy "%allusersprofile%\%P%\TightVNC\*.*" "%allusersprofile%\%U%\TightVNC\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\TightVNC" /S /Q
ECHO.
MD "%allusersprofile%\%U%\Anti-Spyware"
xcopy "%allusersprofile%\%P%\SpywareBlaster\*.*" "%allusersprofile%\%U%\Anti-Spyware\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\SpywareBlaster" /S /Q
xcopy "%allusersprofile%\%P%\SpywareGuard\*.*" "%allusersprofile%\%U%\Anti-Spyware\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\SpywareGuard" /S /Q
ECHO.
MD "%allusersprofile%\%U%\Norton SystemWorks"
xcopy "%allusersprofile%\%P%\Norton SystemWorks\*.*" "%allusersprofile%\%U%\Norton SystemWorks\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\Norton SystemWorks" /S /Q
ECHO.
MD "%allusersprofile%\%U%\My IP Address"
xcopy "%userprofile%\%P%\Camtech\My IPs\*.*" "%allusersprofile%\%U%\My IP Address\*.*" /Q /S /C /E /R /Y
RD "%userprofile%\%P%\Camtech" /S /Q
ECHO.
MD "%allusersprofile%\%U%\Anti-Spyware\Lavasoft Ad-aware 6"
xcopy "%userprofile%\%P%\Lavasoft Ad-aware 6\*.*" "%allusersprofile%\%U%\Anti-Spyware\Lavasoft Ad-aware 6\*.*" /Q /S /C /E /R /Y
RD "%userprofile%\%P%\Lavasoft Ad-aware 6" /S /Q
ECHO.
MD "%allusersprofile%\%U%\Microsoft Office Tools"
xcopy "%allusersprofile%\%P%\Microsoft Office Tools\*.*" "%allusersprofile%\%U%\Microsoft Office Tools\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\Microsoft Office Tools" /S /Q
REM ECHO.
REM xcopy "%allusersprofile%\%P%\Acro*.lnk" "%allusersprofile%\%U%\" /Q /S /C /E /R /Y
REM del "%allusersprofile%\%P%\Acro*.lnk" /F /Q
ECHO.
MD "%allusersprofile%\%U%\QuickTime"
xcopy "%allusersprofile%\%P%\QuickTime\*.*" "%allusersprofile%\%U%\QuickTime\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\QuickTime" /S /Q
ECHO.
MD "%allusersprofile%\%U%\Winamp"
xcopy "%allusersprofile%\%P%\Winamp\*.*" "%allusersprofile%\%U%\Winamp\*.*" /Q /S /C /E /R /Y
RD "%allusersprofile%\%P%\Winamp" /S /Q
ECHO.
xcopy "%userprofile%\%P%\Accessories\*.*" "%allusersprofile%\%P%\Accessories\*.*" /Q /S /C /E /R /Y
RD "%userprofile%\%P%\Accessories" /S /Q
ECHO.
copy "%userprofile%\%P%\*.lnk" "%allusersprofile%\%P%\*.lnk" /Y
DEL "%userprofile%\%P%\*.lnk" /F /Q
ECHO.
copy "%allusersprofile%\%P%\Windows*.*" "%allusersprofile%\%U%" /Y
DEL "%allusersprofile%\%P%\Windows*.*" /F /Q
ECHO.
copy "%allusersprofile%\%P%\Remote*.*" "%allusersprofile%\%U%" /Y
DEL "%allusersprofile%\%P%\Remote*.*" /F /Q
ECHO.
del "%allusersprofile%\start menu\*.lnk" /F /Q
xcopy %I%\Addons\*.* "C:\Documents and Settings\*.*" /Q /S /C /E /R /Y
MD "%ProgramFiles%\CDex"
MD "%ProgramFiles%\WinZip"
xcopy %A%\cdex\*.* "%ProgramFiles%\CDex\*.*" /Q /S /C /E /R /Y
xcopy %A%\WinZip\*.* "%ProgramFiles%\WinZip\*.*" /Q /S /C /E /R /Y
ECHO.
ECHO Adjusting File Associations ...
ECHO.
assoc .blt=txtfile
assoc .cue=txtfile
assoc .diz=txtfile
assoc .eml=txtfile
assoc .iss=txtfile
assoc .log=txtfile
assoc .md5=txtfile
assoc .m3u=txtfile
assoc .nbi=txtfile
assoc .nfo=txtfile
assoc .nt=txtfile
assoc .pif=txtfile
assoc .sam=txtfile
assoc .sif=txtfile
assoc .sfv=txtfile
assoc *=txtfile
ECHO.
ECHO Setting up Scheduled Tasks ...
SCHTASKS /create /TN "Reset Norton AV" /TR c:\Windows\Batfiles\AVRESET.BAT /SC MONTHLY /ST 16:00:00 /RU SYSTEM
ECHO.
SCHTASKS /create /TN "Defragment Hard Disk" /TR c:\Windows\Batfiles\DEFRAG.BAT /SC WEEKLY /ST 17:00:00 /S P4 /U XPUser /P xpuser
ECHO.
ECHO Disable search companion ...
start /wait regsvr32 /u /s %windir%\srchasst\srchui.dll
ECHO.
RD c:\temp /S /Q
RD C:\Ý /S /Q
del %windir%\temp\*.txt
del "%userprofile%\Local Settings\Temp\*.*" /F /Q
del "%userprofile%\Desktop\Spy*.*" /F /Q
del "%allusersprofile%\Desktop\Spy*.*" /F /Q
del "%allusersprofile%\Desktop\Nor*.*" /F /Q
REM del "%allusersprofile%\Desktop\My IP*.*" /F /Q
REM del "%allusersprofile%\Desktop\Acro*.*" /F /Q
ECHO.
%windir%\system32\shutdown.exe -r -t 70 -c "Initial Install Complete!  After you reboot, get online and run Windows Update and Norton LiveUpdate programs to complete installation."
ENDLOCAL
EXIT


Posted

Hi JPamplin,

you can use a switch in your unattend file called "FileSystem" in Section "Unattended". That would look like this:

[unattended]

FileSystem=ConvertNTFS

Your Partition will be converted to NTFS Filesystem, so you can use all NTFS Features.

Have a nice day, :)

Sie Tjin Kian

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