Thursday, 21 July 2016

E2B is Snappy and Chocolatey!

E2B v1.82SDIa_Beta is available for download in the Alternate Download Areas.

Once you have downloaded and added the driverpacks, you will be able to perform a fully automated install of Windows with all drivers and any apps you want too, using an unmodified MS ISO and one of the xxxxxxx_CHOCO_SDI.XMl files on your E2B USB drive.

v1.82 includes the Snappy Driver Installer (SDI) and the Chocolatey application downloader and installer (choco). It does not include the 13GB of Driverpacks which you must download first (once only) yourself!

SDI will automatically install the correct drivers. As it is set up at the moment, these drivers must first be downloaded as DriverPacks onto the E2B USB drive for offline installation using the SDI executable. The DriverPacks are downloaded to the E2B USB drive, so that the next system that you install to can use them, so you will need at least 13GB of space for the Driverpacks if you want them all.

Chocolatey is an app downloader and installer and so required an internet connection. It should work on Win7+ systems (it uses PowerShell). You can add any apps that are available from https://chocolatey.org/packages and it is as simple as adding extra lines into one of the script files on the E2B drive, e.g.

choco install ccleaner

Choco will download the apps from the internet each time you run it, the downloads are NOT stored on the E2B drive.

The trial XML files are for Windows 8 and 10 Pro/Home, US (English) and UK (International).

PLEASE NOTE: Once started from E2B with the correct XML file, Windows Setup will immediately and without warning, wipe your internal hard disk (if you have more than one SATA HDD present in the target system, I advise you to disconnect all of the other HDDs in case Setup picks the wrong HDD - it can and does happen!) It should install all drivers using Snappy (if you have downloaded all the DriverPacks first) and install Chrome and Ccleaner (by default) using choco via the internet.


How to test it


Try a test run on any spare target system as follows:

Requirements

  1. First you will need a removable USB E2B drive
     - OR
    a E2B USB HDD + E2B 'Helper' flash drive (removable type - any size).
  2. Next you will need a Microsoft English (or English International) Windows 10 Professional Install ISO file (because the two demo XML files use USA and English UK settings and a Win10 Pro generic install key).
    Note: The first ISOs released for TH2 (Nov 2015) may have a network bug - internet connections do not work during the 'Specialize' pass which is where the SDI and choco scripts run. I attempt to force the network to work by running msoobe and then killing it if I detect no internet connectivity.
    I suggest you use the latest TH2 ISOs (April 2016). 'English' for USA and 'English International for UK'. I have not tested the Feb 2016 TH2 versions.
    You can use either 32-bit Pro or 64-bit Pro.
    Use the handy ISO file Download Tool here to get an MS ISO and copy the Win 10 Pro English ISO to \_ISO\WINDOWS\WIN10 on your E2B drive.
  3. There must be plenty of space on the E2B drive for DriverPacks (up to 13GB!).
  4. You will need a target system (32-bit or 64-bit) that you can wipe and re-install to.

Preparation

  1. Download the 'SDI_Beta' version of E2B, extract it to a new folder and run UPDATE_E2B_USB_DRIVE.cmd or make a new E2B drive (whichever you prefer).
    This will add a new \_ISO\WINDOWS\INSTALL folder (and some new Win10 XML files).
  2. You now need to download the SDI DriverPacks onto the E2B drive. If you don't add driverpacks, the install will still work, but no drivers will be installed.
    If you have Windows already installed on the 'target' system (or any Windows system), then double-click on \_ISO\WINDOWS\INSTALLS\SNAPPY\SDI_run.bat and click on the (Click here to start the download) text - see screenshot below.
    Note that you will need to allow SDI to access some torrent ports through the Windows Firewall when prompted - if you don't see the Firewall prompt then wait a minute or two. You should eventually see the 'Updates are available' message when a connection has been made with the torrent server.

You should now see the 'Update' Driverpack checkbox list as shown above. Select the drivers that you think you will need for the target system and click on Accept to start downloading them. You can tick the 'Check only needed for this PC' button, if the system you are running SDI on is similar to the target system.
I suggest the Chipset and LAN drivers as a minimum, because choco will need Ethernet access to the LAN later to install apps.

You should check the Indexes box to download them too.

Do not click the large green Install button (unless you want to install drivers onto your system!).
Note: When I tried SDI to update the Win10 drivers on my PC, I found that my Apple iPhone DCIM folder was no longer accessible as it was not recognised as a 'storage' device by Windows!


Note: If you prefer, you can download and extract the 13GB Full SDI download which contains all the driverpacks and then extract the files to the SNAPPY folder (overwrite any files already there). Do NOT delete the AUTO.cmd file as this is used by E2B.

3. Boot to E2B on the target system (WARNING: It will be wiped clean so make sure you don't want anything on it).

4. Ensure the Ethernet cable is connected (you may be able to use WiFi if you have not Enet connection available).

5. Select the Windows 10 Pro ISO from the Windows 10 menu and then select one of the following XML files:
  • Auto_WipeDisk0_Win10ProUK_with_SDI_CHOCO.xml  (for use with 'International' ISO)
    OR
  • Auto_WipeDisk0_Win10ProUS_with_SDI_CHOCO.xml (for use with 'English' ISO)
The install will now proceed automatically now and the internal hard disk will be immediately wiped and re-partitioned. After approx 10-20 minutes and a reboot, you should see the SDI GUI run. Then you may see the choco Chrome being installed. You can remove the E2B drive once this script has completed (you will see a prompt for 5 seconds).
After the automatic user logon, you will then see more chocolatey apps being installed (Ccleaner) and end up at the Desktop with all apps and drivers installed (hopefully!).

On my IdeaPad 300 fitted with an SSD, the whole process (including 19 drivers and 2 applications) takes less than 15 minutes.

Note: If you are using a computer with WiFi and no Ethernet network connection, you may see the 'msoobe' GUI application launch - if you are quick, you can quickly use msoobe to configure your WiFi connection. Once you have entered the connection details and connected to an access point/router, do not proceed any further - use ALT-TAB to switch back to the E2B cmd script and press ENTER - the script should kill msoobe and allow you to proceed (of course you will need either in-box WiFi drivers or you will need to add them to SDI).

How it works

  1. The XML file contains a default user+autologon settings and unattended disk clean&partition settings and UAC disable settings. It also contains a RunSynchronous section to run LOADISO.cmd from the E2B drive (which loads the ISO as a virtual drive) and a second RunSychronous section to run a script located at: \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO.cmd.
    Note: When SDI_CHOCO.cmd runs, there are no User accounts set up, so some applications may not install correctly via choco at this stage and you may get some warning messages because of this. You can always install them later on in the process by using startup.cmd if they do not install correctly (one app is already installed in startup.cmd).
    Also note that because the XML has two sections to run SDI_CHOCO.cmd (one in the x86 section and one in amd64 section), if we install 64-bit Windows 10, there will be two registry entries and so this script will run twice! The script thus writes a .tag file onto the hard disk to ensure it only runs once.
  2. When the \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO.cmd file runs, it copies across a startup.cmd file, adds a RunOnce registry entry for it and then runs SDI and choco.
  3. SetupComplete.cmd (if copied across) will eventually run.  I do not actually do anything inside it at the moment.
  4. When the Desktop is reached, it will auto-login (setting in the XML file) and run the startup.cmd file that was copied earlier. This can perform other tweaks and install more choco applications, if required. It has administrator privileges.
  5. The startup.cmd file finally enables UAC and then deletes itself to keep things tidy. A log file is kept at C:\temp\startup.log.
You can add any 'pauses' into the two .cmd files if you wish (don't add pauses into setupcomplete.cmd because you cannot see any console window!).

Troubleshooting

To run choco there needs to be a working internet connection. If you connect an Ethernet cable to your router, normally Windows will install the correct driver and network stack. However, some versions of Windows (e.g. the first version of Win10 TH2 appears to have a bug and no internet access is available when the SDI_Choco.cmd script runs during the 'Specialize' phase. I try to run msoobe.exe which seems to fix this bug and then kill the task afterwards). If possible, use the latest version of Win 10 TH2 to avoid these issues.

Msoobe.exe also allows you to configure WiFi and select a WiFi SSID name and enter a password. This sets up the wireless connection for you. So it is possible to use WiFi instead of a LAN connection (although it is not automatic). Once you have established a connection, you should not proceed with msoobe any more - it is just used to establish a wireless connection and set up the Windows network stack correctly.

Check the C:\temp folder for .log files.

If chocolatey failed to install, it was probably due to no available network (no Enet driver?). In that case, add more offline LAN SDI Driverpacks + Chipset packs (you can run SDI manually on the finished system to see what packs are required.

You can edit the scripts (change @echo off to @echo on) and make them pause and open up a command shell for you to 'play' with - just add these lines:

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


choco: Yellow text = warnings (ignore), red text=Errors.

Note that some Windows 'Apps' like Photo will not run from the Built-in administrator account if UAC is disabled. If you simply reboot at the end of the installation, then UAC will be enabled due to the registry change we made in startup.cmd.

Tweaking the installation

Edit \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO.cmd to add or remove choco app installs.

For silent (i.e. invisible console window) app installs, you can use the setupcomplete.cmd file (they must not stop or pause).

Edit \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO\startup.cmd to add or remove choco app installs that occur on first user login. You could just add a whole list of apps and then manually choose which ones you want: e.g. do not specify -y and it will prompt you for each one...

choco install googlechrome
choco install 7zip.install
choco install notepadplusplus

The correct way to make you own automated install for say a model DELLXX for Windows 10 would be:
  1. Make a new XML file using the WAFG web page and edit it using XMLtoE2B.exe so it works with E2B (see here for details)
  2. Add in the 'Specialize' pass RunSynchronous section of XML code (see the example XML files) and change "\_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO.cmd" to  e.g. DELLXXW10
  3. Copy the \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO.cmd and give it the same name that you used in the XML file - e.g. DELLXXW10.cmd.
  4. Copy the \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO folder to \_ISO\WINDOWS\INSTALLS\CONFIGS\DELLXX_WIN10
  5. Now edit 
  • \_ISO\WINDOWS\INSTALLS\CONFIGS\delxxw10.cmd
  • (optional) \_ISO\WINDOWS\INSTALLS\CONFIGS\DELLXX_WIN10\setupcomplete.cmd
  • \_ISO\WINDOWS\INSTALLS\CONFIGS\DELLXX_WIN10\startup.cmd
to install the packages or drivers that you require.

Because delxx.cmd runs just after the Windows file copy stage, you can copy over any files you like from the E2B USB drive to the target hard disk. So it is possible to copy over bespoke drivers from the \_ISO\WINDOWS\INSTALLS\DRIVERS\DELLXX folders to the hard disk and then install those drivers. You can also copy over any special application install files from the \_ISO\WINDOWS\INSTALLS\APPS folder and install them either immediately or using the setupcomplete.cmd or startup.cmd scripts.

Note that the same scripts are run on both 32-bit and 64-bit installs, so in some cases you may need to modify your script to test what bitness you are running on.

Adding Applications

Although chocolatey is pretty cool, it does have to download the apps from the internet each and every time (but it will always be a recent version). It would be more efficient to keep the app installer files under the APPS folder and then copy the files to the hard disk and install the apps from the hard disk.

You can download application .msi install files from npackd.appspot.com and copy them to the E2B USB drive \_ISO\WINDOWS\INSTALLS\APPS folder.

You can then either install them directly from the USB drive, or copy the .exe or .msi files to the C:\DRIVERS folder, and install them from the hard disk. To install them silently, use this syntax (examples for 7z and Foxit Reader):

start /wait msiexec /qb- /i C:\DRIVERS\7z1602.msi
start /wait C:\_ISO\WINDOWS\INSTALLS\APPS\Foxit\BOTH\FoxitReader734_enu_Setup_Prom.exe /silent

This means that no internet connection is required (if you don't use choco to install any apps).

Feedback

I would be interested to know if anyone is brave enough to try this - please let me know how you got on!

Please tick one of the Reactions boxes below if you think this sounds a useful feature.