Chocolatey works by downloading a script which tells Chocolatey which developer's download URL to use in order to download the app. installation files, e.g. Google Chrome Setup.exe would be directly downloaded from Google's server. Chocolatey would then install the downloaded file in the correct way using Windows PowerShell.
It is possible to pre-download any of the Chocolatey packages that you want and then to install them offline during Windows Setup using Chocolatey. In this way, no internet connection is required during Windows installations.
I have utilised the ChocolateStore github software by BahKoo so that we can make offline chocolatey packages for the SDI_Choco process using a ChocBox.cmd script.
Note: a few Chocolatey packages will not convert correctly to offline packages at the moment (e.g. for Firefox, you must use the palemoon choco package instead, or else download Firefox from here and install FireFox using the /S command line parameter).
During the Specialize pass, we copy all the app packages from the E2B USB drive to the C:\DRIVERS\CHOCBOX folder of the target system.
During the final user login stage (MyStartup.cmd) we install each app. from the C:\DRIVERS\CHOCBOX folder.
Note: Chocolatey packages should be copied to the C:\DRIVERS\CHOCBOX folder of the target drive or they will not work.
The two Offline methods
There are two scenarios when installing apps offline:
1. Chocolate Box - you have a small set of apps and\or a small set of configurations
In this case, we can group all the choco packages into one CHOCBOX folder. Every system will get the whole box of chocolates!
All packages will be copied to the target hard disk but we can script which ones we want to be installed for each different configuration.
For instance, if we had 20 different apps, total=500MB, then all 500MB would be copied from the E2B drive to the target drive every time.
We can however, have different configurations sets with different MyStartup.cmd scripts to install a different selection of apps for each configuration.
Tip: You could modify the MyStartup.cmd file to prompt the user for a software choice (e.g. 0=No apps, 1=Standard apps, 2=All apps, 3=Developer apps) : e.g. the variable 'GROUP' holds our choice:
set /p GROUP=What group of apps do you want to install (0-3) :
for %%A in (1 2 3) do if "%GROUP%"=="%%A" choco install GoogleChrome -source C:\DRIVERS\CHOCBOX-y -r >> %log%
for %%A in (2 3) do if "%GROUP%"=="%%A" choco install FoxitReader -source C:\DRIVERS\CHOCBOX -y -r >> %log%
Or you could prompt the user for each app:
set ask=& set /p ask=Install Foxit Reader (Y/N) : & if /i "!ask!"=="Y" choco install FoxitReader -source C:\DRIVERS\CHOCBOX -y -r
set ask=& set /p ask=Install Google Chrome (Y/N) : & if /i "!ask!"=="Y" choco install GoogleChrome -source C:\DRIVERS\CHOCBOX -y -r
2. Pick-n-Mix - We only copy the apps we want
This requires more coding/scripting on your part.
In this case, each app (package) has a separate folder on the E2B drive.
We need to write lines of script in the main config file to copy each individual app folder from the E2B drive to the target C: drive.
We only copy the apps that we will install, so we can cope with 100's of different apps and 100's of different configurations on the E2B drive.
1. You must install Chocolatey on your office Windows system first so that you can create the offline packages.
Install choco by running \_ISO\docs\ChocBox\Install_Chocolatey.cmd as Administrator from the E2B USB drive or follow the instructions here (Windows 7 or later is required).
Installation of Chocolatey just copies files to the C:\ProgramData\Chocolatey folder and adds an entry to the Windows shell environment Path variable of your Windows system. .Net Framework 4.0 is required which is not already present in Win7.
2. We need to add the Chocolatey .nupkg package for Chocolatey itself to the E2B drive:
2.1 Run \_ISO\docs\ChocBox\ChocBox.cmd.
2.2 Type Chocolatey for the package name and then press ENTER for the current chocolatey version when prompted to make the chocolatey package file.
2.3 Copy the chocolatey.xxxxxx.nupkg file from C:\DRIVERS\ChocBox to the E2B USB drive \_ISO\WINDOWS\INSTALLS\INSTALLCHOCO folder.
2.4 Rename the .nupkg file at \_ISO\WINDOWS\INSTALLS\INSTALLCHOCO to chocolatey.nupkg
If a new version of choco is released, you can update the chocolatey.nupkg file by repeating steps 1 and 2 above.
3. If you are installing Windows 7 (???), you will need to add the .Net 4.0 Full Standalone dotNetFx40_Full_setup.exe file to the \_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX folder.
Then create a new MySetupComplete.cmd file in your configuration folder (e.g. \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO\MySetupComplete.cmd) with the last line (because it may cause a reboot) as:
if "%WINVER%"=="7" start /wait c:\drivers\chocbox\dotNetFx40_Full_x86_x64.exe /passive
Note: Remember that Win7 does not include drivers for USB 3 or modern USB 2 ports!
First we download and make the offline application packages on our office system, then we copy them to our USB drive.
1. Double-click on the \_ISO\docs\ChocBox\ChocBox.cmd file - type in the name of your app and check it downloads and converts correctly.
When prompted for an 'Exact Name' type the full package name (no version umber). You can also press W to look-up the name of the package on the web.
Even if the partial search returns no matches (NONE), you can still try typing the exact full package name.
When asked for a version number, press ENTER for the latest approved version (or enter the version number required).
IMPORTANT: Make sure that you get a .nupkg file - sometimes there will be an associated folder too (and sometimes not).
Note: If there is a package which has .install in the name (or similar), then specify that name, e.g. notepadplusplus.install instead of notepadplusplus.
Note: ChocBox will make a C:\DRIVERS\CHOCBOX folder on your Windows office system. This folder location must not be changed because each package will be made so that it runs from only that specific folder.
If you have problems finding a package, check on the chocolatey website here.
Note: ChocolateStore may report errors, however if it downloaded a .nupkg + payload file (e.g. .msi or .exe) then it is worth trying it anyway.
For example, ChocolateStore reports errors with Skype, but it still works if you use the .nupkg and the folder containing the .msi.
Tip: Skype also requires some DLLs for Win10, so you need to also install vc_redist from here, copy it to the CHOCBOX folder on your E2B drive and install it using %systemdrive%\DRIVERS\CHOCBOX\vc_redist.x86.exe /q /norestart in your MyStartUp.cmd file.
2. Repeat for all apps that you want to install.
3. Copy the contents of the C:\DRIVERS\CHOCBOX folder to the E2B drive's \_ISO\WINDOWS\INSTALL\APPS\CHOCBOX folder.
You only need to copy the .nupkg + package folders of each app that you want.
The following instructions assume that XXXXXX is your configuration name, for instance SDI_CHOCO is the default configuration and you can use that if you wish. The SDI_CHOCO config files will not be overwritten if you update E2B at a later date.
4. Make two new files in the \_ISO\WINDOWS\INSTALLS\CONFIGS\XXXXXX folder (any size):
OfflineChoco.TAG - causes the \_ISO\WINDOWS\INSTALL\APPS\CHOCBOX folder to be copied automatically and choco to be installed offline
NoInternet.TAG - will not try to enable WiFi internet connectivity
If you wish, you can omit the NoInternet.TAG file and it will ensure it is connected to the internet (even by WiFi) and then you can use use both online and offline choco installs. If you have an Ethernet cable connected, you will probably have a working internet connection regardless of the NoInterner.TAG file (if the network drivers have been installed).
5. Copy the Sample_MyStartup.cmd file to \_ISO\WINDOWS\INSTALLS\CONFIGS\XXXXXX\MyStartup.cmd
Make a MyStartup.cmd file from the Sample_MyStartup.cmd sample file.
6. Edit MyStartup.cmd to install your offline packages individually (you should see some example lines already present)
:: ---- OFFLINE INSTALL OF CHOCO PACKAGES ----
:: Install any offline packages that were in USB:\_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX folder - each one must be named by name
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG start /wait %systemdrive%\DRIVERS\nircmd speak text "Installing Fox it reader, win merge, prod u key and notepad plus plus"
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG echo Installing Offline Choco packages...
:: Some packages require chocolatey-core.extension, so always install this first
You can then add lines to your MyStartup.cmd file to install them.
2. Pick-n-Mix (only copy and install the purple and orange ones!)
1. Double-click on the \_ISO\docs\ChocBox\ChocBox.cmd file - type in the name of your app - check it downloads correctly.
Notes: ChocBox will make a C:\DRIVERS\CHOCBOX folder on your Windows office system. This folder location must not be changed because each package is re-compiled by chocbox.cmd so that it runs from that folder.
2. Repeat for all apps that you want to install.
3. Copy each package (.nupkg + folder if present) from the C:\DRIVERS\CHOCBOX folder to the E2B drive's \_ISO\WINDOWS\INSTALL\APPS\ folder, make a new folder for each package, e.g. make new FoxIt_Choco and NotePP_Choco folders for the packages...
Some choco packages also require the 'chocolatey-core.extension' package.
So make sure the 'chocolatey-core.extension' package is present in the \_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX folder.
You can use ChocBox.cmd to download a more recent version, if needed.
If OfflineChoco.TAG is present, then the whole \_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX folder will also be copied to C:\DRIVERS\CHOCBOX.
The following instructions assume that XXXXXX is your configuration set name...
4. Make two new files in the \_ISO\WINDOWS\INSTALLS\CONFIGS\XXXXXX folder:
5. Copy the Sample_MyStartup.cmd file to MyStartup.cmd
6. Edit the MyStartup.cmd to install your offline packages individually
:: Now we install Chocolatey directly from USB drive
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG echo Installing Chocolatey from E2B drive...
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG call %USB%\_ISO\WINDOWS\INSTALLS\INSTALLCHOCO\InstallChoco.cmd >> %log%
:: ---- END OF OFFLINE APPS -----
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG xcopy /herky %USB%\_ISO\WINDOWS\INSTALLS\APPS\Chrome_CHOCO\*.* %SystemDrive%\DRIVERS\CHOCBOX\ >> %log%
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG xcopy /herky %USB%\_ISO\WINDOWS\INSTALLS\APPS\Foxit_CHOCO\*.* %SystemDrive%\DRIVERS\CHOCBOX\ >> %log%
Note: The destination path MUST be C:\DRIVERS\CHOCBOX\ or else the package will not install.
8. Finally, don't forget to make a new XML file which uses your new configuration name XXXXXX instead of SDI_CHOCO.
e.g. Modify ZZDANGER_Auto_WipeDisk0_Win10ProUS_with_SDI_CHOCO.xml, rename it and copy it to the \_ISO\WINDOWS\WIN10 folder.
Note: Any files/folders in the \_ISO\WINDOWS\INSTALL\APPS\CHOCBOX folder will also be copied to the target hard disk during setup. You can put all 'common' app packages in that folder or just leave it empty.
Install Microsoft Office
There are some choco packages for Office365 and OfficeProPlus2013, but these may not be suitable as they require internet access (but I have not tested them).
However, you can install any version of Office if you have the Setup installation files.
Office can be installed using a command such as:
setup.exe /config [path to XML file]
You can generate an XML configuration file to automate the install by using the appropriate Office 2010\2013\2016 configurator page on this site.
Most people use the x86 version of Office because the 64-bit version may not be compatible with some plug-ins.
Copying the Office Setup files to the target drive
A simple way to add Office would be to copy the Office Setup.exe file and XML file to your configuration folder (e.g. put them in \_ISO\WINDOWS\INSTALLS\CONFIGS\SDI_CHOCO) then it will be automatically copied to C:\DRIVERS every time you perform an installation.
Alternatvely, copy the Setup.exe and XML files to the \_ISO\WINDOWS\INSTALLS\APPS\CHOCBOX folder. If you have the OfflineChoc.TAG file in your configuration folder, the files will be automatically copied to C:\DRIVERS\CHOCBOX.
Another alternative is to create a separate folder for the files (e.g. \_ISO\WINDOWS\INSTALLS\APPS\OFFICE2016) and put a line in your MySpecialize.cmd file to copy the contents, e.g.
if exist %systemdrive%\DRIVERS\OfflineChoco.TAG xcopy /herky %USB%\_ISO\WINDOWS\INSTALLS\APPS\OFFICE2016\*.* %SystemDrive%\DRIVERS\ >> %log%
Assuming that the Setup.exe and XML files are now in the C:\DRIVERS folder, use a line like this in your MyStartup.cmd file:
I would advise you to test your XML file by installing Office on a freshly installed system using the 'Setup /config xxxx.xml' command to make sure it works without user interaction and as you want it to be configured (user name, product key, etc.). If it doesn't work, then uninstall Office, remake your XML file and try again!