Jump to content

Add Destop icons during unattended install


Recommended Posts

I do this by placing a .cmd file in $OEM$\$1\TEMP called "unattend.cmd" that is called from [setupParams] in my WINNT.SIF file, and it simply adds some RunOnce registry entries. Thes entries install applications, then run a .cmd file at the end before rebooting that imports registry settings and copies over shortcuts to the All Users desktop and start menu.

My WINNT.SIF looks like so:

[Data]
AutomaticUpdates = YES
AutoPartition = 0
MsDosInitiated = 0
UnattendedInstall = Yes
OemDrivers = OemInfFiles

[Unattended]
Unattendmode = FullUnattended
UnattendSwitch = YES
OemPreinstall = YES
OemPnPDriversPath = drivers\audio;drivers\chipset;drivers\misc\wireless;drivers\modem;drivers\network;drivers\RAID;drivers\touchpad;drivers\video
OemSkipEULA = YES
TargetPath = WINDOWS
Filesystem = ConvertNTFS
DUDisable = YES
Hibernation = NO
WaitForReboot = NO
NoWaitAfterTextMode = 1
NoWaitAfterGUIMode = 1
DriverSigningPolicy = Ignore
NonDriverSigningPolicy = Ignore

[OemInfFiles]
OemDriverFlags = 1
OemDriverPathName = "%SystemRoot%\nldrv"
OemInfName = "hpt3xx.inf"

[GuiUnattended]
TimeZone = 035
AdminPassword = *
EncryptedAdminPassword = NO
OemSkipWelcome = 1
OEMSkipRegional = 1
AutoLogon = YES
AutoLogonCount = 3

[SetupParams]
UserExecute=%systemdrive%\temp\unattend.cmd

[UserData]
FullName = USER
OrgName = ORG
ComputerName = *
ProductKey = xxxxx-xxxxx-xxxxx-xxxxx

[Display]
BitsPerPel = 32
Xresolution = 1024
YResolution = 768

[Identification]
JoinWorkgroup = WORKGROUP

[Networking]
InstallDefaultComponents = Yes

[NetOptionalComponents]
Beacon = 0

[Components]
Accessopt = Off
CertSrv = Off
CertSrv_Client = Off
CertSrv_Server = Off
Chat = Off
Deskpaper = Off
Dialer = Off
Fax = Off
Fp_extensions = Off
FP_Vdir_Deploy = Off
Freecell = Off
Hearts = Off
IIS_Common = Off
IIS_Doc = Off
IIS_FTP = Off
IIS_HTMLa = Off
IIS_Inetmgr = Off
IIS_NNTP = Off
IIS_NNTP_Docs = Off
IIS_Pwmgr = Off
IIS_SMTP = Off
IIS_SMTP_Docs = Off
IIS_WWW = Off
IIS_WWW_Vdir_Printers = Off
IIS_WWW_Vdir_TerminalServices = Off
IISDbg = Off
Indexsrv_system = Off
LicenseServer = Off
Media_utopia = Off
Minesweeper = Off
Mousepoint = Off
Msmsgs = Off
MSMQ_ADIntegrated = Off
MSMQ_Core = Off
MSMQ_HTTPSupport = Off
MSMQ_LocalStorage = Off
MSMQ_MQDSService = Off
MSMQ_RoutingSupport = Off
MSMQ_TriggersService = Off
Msnexplr = Off
Netoc = Off
OEAccess = Off
Pinball = Off
Solitaire = Off
Spider = Off
WMAccess = Off
zonegames = Off

[PCHealth]
ER_Display_UI = 0
ER_Enable_Applications = None
ER_Enable_Kernel_Error = 0
ER_Enable_Reporting = 0
ER_Enable_Windows_Components = 0
ER_Force_Queue_Mode = 0
ER_Include_MSApps = 0
ER_Include_Shutdown_Errs = 0

[Shell]
DefaultStartPanelOff = YES
DefaultThemesOff = YES

[SystemFileProtection]
SFCQuota = 0

[SystemRestore]
MaximumDataStorePercentOfDisk = 7
RestorePointLife = 7

[Branding]
BrandIEUsingUnattended = Yes

[URL]
Home_Page = http://www.google.com
Search_Page = http://www.google.com/ie_rsearch.html

My unattend.cmd file looks like so:

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// $OEM$\$1\TEMP on CD is copied to %systemdrive%\temp, so switch into that first.

%systemdrive%
cd\temp

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Copy custom default user profile. Load some HKLM settings by merging shell.reg into registry.
:// Since at this point, no profiles have been created yet, making these changes to Default User means Administrator, and
:// any future users that are created, will get these settings.

attrib -h "C:\Documents and Settings\Default User"
attrib -h -r "C:\Documents and Settings\Default User\Application Data"
attrib -h "C:\Documents and Settings\Default User\ntuser.dat"
xcopy "%systemdrive%\TEMP\profile\Quick Launch" "C:\Documents and Settings\Default User\Application Data\Microsoft\Internet Explorer\Quick Launch" /s/i/q
copy /y "%systemdrive%\TEMP\profile\Internet Explorer.lnk" "C:\Documents and Settings\All Users\Start Menu"
copy /y "%systemdrive%\TEMP\profile\Windows Explorer.lnk" "C:\Documents and Settings\All Users\Start Menu"
copy /y %systemdrive%\TEMP\profile\ntuser.dat "C:\Documents and Settings\Default User"
copy /y "%systemdrive%\TEMP\profile\Task Manager.lnk" "C:\Documents and Settings\Default User\Start Menu\Programs\Startup"
copy /y "C:\Documents and Settings\All Users\Start Menu\Windows Update.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools"
attrib +h "C:\Documents and Settings\Default User"
attrib +h +r "C:\Documents and Settings\Default User\Application Data"
attrib +h "C:\Documents and Settings\Default User\ntuser.dat"
%windir%\regedit /s shell.reg
%windir%\regedit /s tweaks.reg

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Copy Winzip to \Program Files\Winzip folder.

xcopy %systemdrive%\TEMP\winzip %systemdrive%\progra~1\winzip /i/q

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Set RunOnceEx Goo to install applications after the reboot.

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx

REG ADD %KEY% /V TITLE /D "Installing Applications" /f

REG ADD %KEY%\001 /VE /D "Windows XP Support Tools" /f
REG ADD %KEY%\001 /V 1 /D "%systemdrive%\TEMP\suptools\suptools.msi /qn" /f
REG ADD %KEY%\001 /V 2 /D "%systemdrive%\TEMP\rktools\rktools.msi /qn" /f
REG ADD %KEY%\001 /V 3 /D "%systemdrive%\TEMP\adminpak\adminpak.msi /qn" /f
REG ADD %KEY%\001 /V 4 /D "%systemdrive%\TEMP\gpmc\gpmc.msi /qn" /f
REG ADD %KEY%\001 /V 5 /D "%systemdrive%\TEMP\bootvis\bootvis.msi TRANSFORMS=%systemdrive%\TEMP\bootvis\bootvis.mst /qn" /f
REG ADD %KEY%\001 /V 6 /D "%systemdrive%\TEMP\pstools\pstools.exe /verysilent /SP-" /f
REG ADD %KEY%\001 /V 7 /D "%systemdrive%\TEMP\putty\putty.exe /verysilent /SP-" /f
REG ADD %KEY%\001 /V 8 /D "%systemdrive%\TEMP\regclean\regclean.exe /verysilent /SP-" /f

REG ADD %KEY%\005 /VE /D "Windows XP Updates" /f
REG ADD %KEY%\005 /V 1 /D "%systemdrive%\TEMP\jrnlvwr\jrnlvwr.msi /qn" /f
REG ADD %KEY%\005 /V 2 /D "%systemdrive%\TEMP\hotfix\HMTCDWizard_enu.exe /qn" /f

REG ADD %KEY%\010 /VE /D "Windows XP Messaging Components" /f
REG ADD %KEY%\010 /V 1 /D "%systemdrive%\TEMP\winmess\messenger.msi /qn" /f
REG ADD %KEY%\010 /V 2 /D "%systemdrive%\TEMP\winmess\communicator.msi /qn" /f

REG ADD %KEY%\015 /VE /D "Windows XP PowerToys" /f
REG ADD %KEY%\015 /V 1 /D "%systemdrive%\TEMP\xppower\deskman.exe /v/qn" /f
REG ADD %KEY%\015 /V 2 /D "%systemdrive%\TEMP\xppower\taskstch.exe /v/qn" /f

REG ADD %KEY%\020 /VE /D "BGInfo" /f
REG ADD %KEY%\020 /V 1 /D "%systemdrive%\TEMP\bginfo\bginfo.msi /qn" /f

REG ADD %KEY%\025 /VE /D "Diskeeper" /f
REG ADD %KEY%\025 /V 1 /D "%systemdrive%\TEMP\dskeeper\dskeeper.msi /qn" /f

REG ADD %KEY%\030 /VE /D "SmartFTP" /f
REG ADD %KEY%\030 /V 1 /D "%systemdrive%\TEMP\smartftp\smartftp.msi /qn" /f

REG ADD %KEY%\035 /VE /D "WinZIP" /f
REG ADD %KEY%\035 /V 1 /D "%systemdrive%\progra~1\winzip\winzip32.exe /noqp /autoinstall" /f

REG ADD %KEY%\040 /VE /D "WinRAR" /f
REG ADD %KEY%\040 /V 1 /D "%systemdrive%\TEMP\winrar\winrar.msi /qn" /f

REG ADD %KEY%\045 /VE /D "Adobe Acrobat 7" /f
REG ADD %KEY%\045 /V 1 /D "\"%systemdrive%\TEMP\adobe\Adobe Reader 7.0.msi\" /qn" /f

REG ADD %KEY%\050 /VE /D ".Net Framework 1.1" /f
REG ADD %KEY%\050 /V 1 /D "%systemdrive%\TEMP\dotnetfx\dotnetfx.exe /q:a /c:\"install /l /q\"" /f
REG ADD %KEY%\050 /V 2 /D "%systemdrive%\TEMP\dotnetfx\867460.exe /q" /f
REG ADD %KEY%\050 /V 3 /D "%systemdrive%\TEMP\dotnetfx\886903.exe /q" /f

REG ADD %KEY%\055 /VE /D "Windows Media Player 10" /f
REG ADD %KEY%\055 /V 1 /D "%systemdrive%\TEMP\wmp\MP10Setup.exe /q:A /c:\"setup_wm.exe /Q /R:N /DisallowSystemRestore\"" /f
REG ADD %KEY%\055 /V 2 /D "%systemdrive%\TEMP\wmp\wmcsetup.exe /q" /f

REG ADD %KEY%\075 /VE /D "Recovery Console" /f
REG ADD %KEY%\075 /V 1 /D "%systemdrive%\TEMP\cleanup.cmd" /f

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Change boot.ini timeout to 0.

bootcfg /timeout 0

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Restart.

:end
shutdown -r -t 0

And my cleanup.cmd file looks like so:

@echo off

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Install the Recovery Console.

reg query hklm\software\microsoft\windows\currentversion\setup /v sourcepath > source
for /f "tokens=3 skip=3" %%1 in (source) do set sourcepath=%%1
xcopy %sourcepath%i386 %systemdrive%\i386 /s/i/q
regedit /s %systemdrive%\TEMP\source.reg
regedit /s %systemdrive%\TEMP\shell.reg
regedit /s %systemdrive%\TEMP\tweaks.reg
%systemdrive%\i386\winnt32.exe /cmdcons /unattend /dudisable

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Allow RDP, File and Printer Sharing, ICMP, and Office Communicator through the Windows Firewall.

netsh firewall set service type = fileandprint mode = enable scope = all
netsh firewall set service type = remotedesktop mode = enable scope = all
netsh firewall set icmpsetting type = all mode = enable
netsh firewall add allowedprogram "C:\Program Files\Microsoft Office Communicator\communicator.exe" "Microsoft Office Communicator 2005" ENABLE

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Move/remove unwanted shortcuts.

copy /y "C:\TEMP\Icons\Desktop\*.lnk" "C:\Documents and Settings\All Users\Desktop"
copy /y "C:\TEMP\Icons\SMenu\*.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs"

md "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\Windows Support Tools"
md "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\Windows Resource Kit Tools"

xcopy "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Support Tools" "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\Windows Support Tools" /s/i/q
xcopy "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Resource Kit Tools" "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\Windows Resource Kit Tools" /s/i/q
copy "C:\Documents and Settings\All Users\Start Menu\Programs\SmartFTP\SmartFTP.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\Accessories"
copy /y "C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office Communicator 2005.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\Accessories"
copy /y "C:\Documents and Settings\All Users\Start Menu\Programs\Winzip\WinZip 9.0 SR-1.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\Accessories"
copy "C:\Documents and Settings\All Users\Start Menu\Programs\Executive Software Diskeeper.lnk" "C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools"

del c:\docume~1\alluse~1\startm~1\setpro~1.lnk
del "C:\Documents and Settings\All Users\Start Menu\WinZip.lnk"
del "C:\Documents and Settings\All Users\Desktop\WinZip.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Activate Windows.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Windows Catalog.lnk"
del "C:\Documents and Settings\All Users\Desktop\Adobe Reader 7.0.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Adobe Reader 7.0.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Startup\Adobe Reader Speed Launch.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Windows Update.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Journal Viewer.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Media Connect.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Movie Maker.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Executive Software Diskeeper.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Messenger.lnk"
del "C:\Documents and Settings\All Users\Start Menu\Programs\Microsoft Office Communicator 2005.lnk"
del /Q "C:\Documents and Settings\All Users\Start Menu\Programs\SmartFTP\*.*"
del /Q "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Support Tools\*.*"
del /Q "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Resource Kit Tools\*.*"
del /Q "C:\Documents and Settings\All Users\Start Menu\Programs\Winzip\*.*"
del /Q "C:\Documents and Settings\Administrator\Start Menu\Programs\PowerToys for Windows XP\*.*"

rd "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Support Tools"
rd "C:\Documents and Settings\All Users\Start Menu\Programs\Windows Resource Kit Tools"
rd "C:\Documents and Settings\All Users\Start Menu\Programs\Winzip"
rd "C:\Documents and Settings\All Users\Start Menu\Programs\SmartFTP"
rd "C:\Documents and Settings\Administrator\Start Menu\Programs\PowerToys for Windows XP"

del "C:\Documents and Settings\Administrator\Start Menu\Programs\Internet Explorer.lnk"
del "C:\Documents and Settings\Administrator\Start Menu\Programs\Outlook Express.lnk"
del "C:\Documents and Settings\Administrator\Start Menu\Programs\Remote Assistance.lnk"
del "C:\Documents and Settings\Administrator\Start Menu\Programs\Windows Media Player.lnk"
del "C:\Documents and Settings\Default User\Start Menu\Programs\Remote Assistance.lnk"
del "C:\Documents and Settings\Default User\Start Menu\Programs\Windows Media Player.lnk"

cscript %systemdrive%\TEMP\desktop.vbs

label c:WINXP

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Change default scripting engine from Wscript to Cscript.

cscript //h:cscript //s

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Set the machinetype as a registry key, then query it to set the %machinetype% variable.
:// Install all hardware-specific software later, based on the returned %machinetype%.

cscript %systemdrive%\TEMP\machine.vbs

reg query hklm\software\microsoft\windows\currentversion\setup /v machinetype > machinetype
for /f "tokens=3 skip=3" %%1 in (machinetype) do set machinetype=%%

IF "MACHINETYPE"=="Other" GOTO DESKTOP
IF "MACHINETYPE"=="Unknown" GOTO DESKTOP
IF "MACHINETYPE"=="Desktop" GOTO DESKTOP
IF "MACHINETYPE"=="Low_Profile_Desktop" GOTO DESKTOP
IF "MACHINETYPE"=="Pizza_Box" GOTO DESKTOP
IF "MACHINETYPE"=="Mini_Tower" GOTO DESKTOP
IF "MACHINETYPE"=="Tower" GOTO DESKTOP
IF "MACHINETYPE"=="Portable" GOTO LAPTOP
IF "MACHINETYPE"=="Laptop" GOTO LAPTOP
IF "MACHINETYPE"=="Notebook" GOTO LAPTOP
IF "MACHINETYPE"=="Handheld" GOTO LAPTOP
IF "MACHINETYPE"=="Docking_Station" GOTO LAPTOP
IF "MACHINETYPE"=="All-in-One" GOTO DESKTOP
IF "MACHINETYPE"=="Sub-Notebook" GOTO LAPTOP
IF "MACHINETYPE"=="Space_Saving" GOTO DESKTOP
IF "MACHINETYPE"=="Lunch_Box" GOTO DESKTOP
IF "MACHINETYPE"=="Main_System_Chassis" GOTO DESKTOP
IF "MACHINETYPE"=="Expansion_Chassis" GOTO DESKTOP
IF "MACHINETYPE"=="Sub-Chassis" GOTO DESKTOP
IF "MACHINETYPE"=="Bus_Expansion_Chassis" GOTO DESKTOP
IF "MACHINETYPE"=="Peripheral_Chassis" GOTO DESKTOP
IF "MACHINETYPE"=="Storage_Chassis" GOTO DESKTOP
IF "MACHINETYPE"=="Rack_Mount_Chassis" GOTO DESKTOP
IF "MACHINETYPE"=="Sealed-Case_PC" GOTO DESKTOP

:DESKTOP

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Nothing specific for this installation - yet.

goto XIT

:LAPTOP

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Nothing specific for this installation - yet.

goto XIT


:XIT

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Delete Run key used to execute this script, add RunOnce key to delete temp dir on startup.

reg delete HKLM\Software\Microsoft\Unattend /f
reg delete HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v unattend /f
reg add "hklm\software\microsoft\windows nt\currentversion\winlogon" /v AutoAdminLogon /t REG_SZ /d 0 /f
reg add "hklm\software\microsoft\windows\currentversion\runonce" /v cleanup /t REG_SZ /d "cmd /c rd /s/q %systemdrive%\temp"

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Change boot.ini timeout to 3.

bootcfg /timeout 3

:// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
://
:// Restart.

:end
shutdown -r -t 0

Edited by cluberti
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...