Sunday 17 July 2016

Automatically install drivers with Snappy Driver Installer

Today I discovered Snappy Driver Installer (SDI). It has been around for a while but I had not heard of it before.

If you don't have all the DriverPacks it needs, SDI will download them via torrents, but it can take a while...

You can download this utility to a USB drive and just run it from any Windows system (XP->Win10, 32-bit or 64-bit). It will look at your hardware and current Windows drivers and then search for a better driver within it's Driverpacks and then install it. The downloads are in 'Driver Packs'. A full download will take 13GB of drive space if you want all the driver packs, or it can be asked to download just the ones you need.

The nice thing about SDI is that you can also run it from the command line and it can be automated.

So using SDI and a few scripts, I added some new folders to my Easy2Boot USB drive.

The folder structure on the E2B USB drive is currently:

\_ISO\WINDOWS\INSTALLS
      \APPS - contains installers and scripts to execute them
      \DRIVERS\904HA\WIN1032 - contains scripts and special drivers to copy to HDD
      \SNAPPY    - contains the SDI files
      \CONFIGS - contains main .cmd file specified in RunOnce portion of XML file


Using a completely original, unaltered Microsoft Windows 10 32-bit Install ISO, I can now do a fully automated OS install with apps and drivers from my E2B Flash drive.

I am working on a scheme that:
  1. Uses an XML file to automatically wipe the hard disk and install Windows (autologon is enabled and UAC is disabled)
  2. After Win10 has been copied over, the system will then automatically copy over any applications and drivers to the hard disk from the USB drive (except the SDI folder).
  3. Any special drivers, etc. can now be installed (scripted)
  4. SDI will now run and automatically install any other drivers (the USB drive is required to be left in until SDI has finished - it can then be removed)
  5. If required, applications can be installed (for all users)
  6. SetupComplete.cmd will automatically run at the end of setup.
  7. On first (automatic) user logon, a startup script will run. This can be used to install more apps and configure the user's profile, if required. Reboots can be performed, but the same startup.cmd script will run again, so you must check for a reboot in your script and jump to another script to complete any installs, etc.

Currently I have this working on my Asus EeePC 904HA netbook with Win10 32-bit. It installs all drivers (Device Manager is clean) and Google Chrome fully automatically in 45 minutes (it has USB 2.0 ports and just 2GB of RAM so it is quite slow - using a Lenovo IdeaPad 300 with SSD and a USb 3.0 port it takes  under 12 minutes).

I have arranged it so that it will automatically detect the correct 32\64-bit version to install (e.g. Chrome 64-bit on a 64-bit Windows OS). So the same XML can be used for both 32-bit and 64-bit Windows OS installs.

The system will be designed to be flexible, so a user can install any apps they like if they are added to the appropriate folder. By choosing the appropriate XML file from E2B, they can control what configuration they want.

I will test it out on a Lenovo IdeaPad 300 next week and maybe add a few more apps too, and then provide it as a download for you to try (or I may even add it to E2B and include a generic SDI XML file too!). The download will be fairly small and contain SDI Lite (<10MB) because you can run SDI manually and download the DriverPacks yourself - you can choose which ones you want).

I would suggest you download the Network driver pack and chipset driver pack first, so that these can be installed offline. Once you have a network connection, you could then run SDI again (manually or automatically). You could even connect to a network share which contained a full SDI folder and run SDI again from the network share to add the rest of the drivers.

It would be possible to copy the whole SDI+DriverPacks folder from the USB drive to the target hard disk. This would allow you to remove the USB drive and use it on another system sooner. However, this would involve copying up to 13GB of files.

SDI is a fantastic tool for anyone who needs to install Windows systems on a regular basis.


Current scripts

Main script (specified in the XML file)

\INSTALLS\904_W1032.cmd
title %~0
prompt $P_$T$G
set BIT=%PROCESSOR_ARCHITECTURE%
set log=%systemdrive%\%~n0.log
echo %~0 >> %log%
set USB=%~d0
set >> %log%
echo USB=%USB% >> %log%
:: Only Public user will be present at this point...
dir %SystemDrive%\users\*.* >> %log%

:: COPY DRIVERS FOLDER
xcopy /herky %USB%\INSTALLS\DRIVERS\904HA\WIN1032\*.* %SystemDrive%\DRIVERS\ >> %log%

:: Chrome - copy files to DRIVERS\APPS folder - any .cmd will automatically run via startup.cmd
:: either BOTH or  amd64+x86 will exist, so one of these next two lines will 'fail'
xcopy /hrky %USB%\INSTALLS\APPS\CHROME\BOTH\*.*  %SystemDrive%\DRIVERS\APPS\ >> %log%
xcopy /herky %USB%\INSTALLS\APPS\CHROME\%BIT%\*.* %SystemDrive%\DRIVERS\APPS\ >> %log%

:: Copy over SETUPCOMPLETE.CMD
xcopy /y %USB%\INSTALLS\DRIVERS\904HA\WIN1032\setupcomplete.cmd %WINDIR%\SETUP\SCRIPTS\ >> %log%

:: Add in StartUp file to always run on login (even if reboot) - delete file when all installs completed
xcopy /y %USB%\INSTALLS\DRIVERS\904HA\WIN1032\startup.cmd "%systemdrive%\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\" >> %log%

:: Run Snappy Driver Update
echo Starting SDI >> %log%
call %USB%\INSTALLS\SDI\AUTO.cmd
echo Finished SDI >> %log%
:: Note: May need to run twice after reboot, so you can re-run it in SetupComplete.cmd or StartUp.cmd

color 2f
echo OK TO REMOVE USB DRIVE NOW....

:: open command prompt now (will be visible to user)
echo Type EXIT to continue
cmd /K
pause

exit



This script is run on user login:
Startup.cmd
:: This is added into the default Startup folder C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\

title %~pnx0
prompt $P_$T$G
echo %~pnx0 is running

:: Find USB drive if left in still
::for %%i 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 %%i:\_ISO\e2b\grub\e2b.cfg ::set USB=%%i:
::echo Found USB drive as drive %USB% >> C:\startup.log

:: Install any apps we have added - run all .cmd files in DRIVERS\APPS folder...
FOR %%I IN (C:\DRIVERS\APPS\*.cmd) DO CALL :loopbody %%I

::Example:
::IF NOT EXIST %SystemRoot%\SysWOW64 start /w msiexec.exe /i "C:\DRIVERS\GoogleChromeStandaloneEnterprise32.msi" /q /norestart >> %SystemDrive%\startup.log 
::IF EXIST %SystemRoot%\SysWOW64     start /w msiexec.exe /i "C:\DRIVERS\GoogleChromeStandaloneEnterprise64.msi" /q /norestart >> %SystemDrive%\startup.log


:: Allow user to run shell and type commands, etc.
::echo Type exit to continue...
::cmd /K
::pause

:: Now enable UAC on next boot
regedit /S C:\DRIVERS\UAC_Default.reg >> %SystemDrive%\startup.log

echo %~0 FINISHED >> %SystemDrive%\startup.log

:: Delete this file so it doesn't run on next boot (must be followed immediately by exit)
::DEL /F /Q %0 >nul
exit

:loopbody
ECHO Running %1 >> %SystemDrive%\startup.log
call %1 >> %SystemDrive%\startup.log
ECHO Finished %1 >> %SystemDrive%\startup.log
ECHO ---------------- >> %SystemDrive%\startup.log
GOTO :EOF


Here is the XML file section which is added to the Specialize pass...

<component name="Microsoft-Windows-Deployment" 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">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Order>1</Order> 
<Path>cmd /q /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:\INSTALLS\904_W1032.CMD  cmd /k %i:\INSTALLS\904_W1032.cmd"</Path>
<Description>Mount ISO as Virtual DVD</Description> 
</RunSynchronousCommand>
</RunSynchronous>
</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 /q /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:\INSTALLS\904_W1064.CMD  cmd /k %i:\INSTALLS\904_W1064.cmd"</Path>
<Description>Mount ISO as Virtual DVD</Description> 
</RunSynchronousCommand>
</RunSynchronous>
</component>



No comments:

Post a Comment