Windows Application Packaging with Chocolatey

Windows Application
Packaging with Chocolatey
Keith Garner
@KeithGa1
Solutions Architect at 1E
Michael Niehaus
@MNiehaus
Marketing Director at Microsoft
Keith Garner
@KeithGa1
MDT Dev/PM, Microsoft MVP
Way too long…
Ran Mercer Is. ½ Marathon
Michael Niehaus
@MNiehaus
MDT Dev/PM, Windows Guru
Been here, done that…
Ran Mercer Is. ½ Marathon
About Keith
Working in/around Microsoft for over 20 years
Speaker at MMS, TechEd, and more…
Microsoft IT
MCS/Support/WHQL/Marketing/…
Windows PG, Surface PG
Oh and … SCCM / MDT
Now working for 1E – Solution Architect
Overview
Application Packaging – State of the union
What is Chocolatey? OneGet? NuGet?
How do I create Application packages in Chocolatey?
How can this help me with MDT/SCCM?
What is the Future of Application Packaging
Background/History
Laziness is good… When channeled constructively
Problem: It’s hard to install drivers
Idea: Use the PnP ID to help pick out the correct drivers
Gotcha: Not all drivers ready as *.INF, and don’t play well with others
Problem: Installing patches/updates is hard
Idea: Write a script to connect to WU and install everything
Gotcha: Not all patches from WU should be applied
Problem: Installing Applications is a pain….
State of the Union
Application Packaging
In the Beginning…
We installed ran programs from Floppy disks…
We got Hard Disks, which required copying…
We developed libraries, and gave us DLL Hell
Runme.bat
Install.exe
Setup.exe
Microsoft Installer MSI…
Industry standard for Desktop App Installation
Created Circa Windows 2000 / Office 2000
Mini-database format for Files, Registry, …
Supports Automation, Patching, Rollbacks, Removal…
Custom Actions
Supported by many tools… WIX, Orca, Install Shield…
Challenges: Supports Custom Actions
…Microsoft Installer MSI
MSIExec.exe /i <File>.msi
MSIExec.exe /quiet /norestart /i <File>.msi
MSIExec.exe /qb- /norestart /l*vx %temp%\<file>.log /i
<File>.msi
Msiexec.exe /qb- /l*vx %LogPath%\MDT.log /norestart /i
https://download.microsoft.com/download/3/0/1/3012B93D-C445-44A9-8BFBF28EB937B060/MicrosoftDeploymentToolkit2013_x64.msi
Challenges with Application Packaging
Applications come in all sizes: Tiny to SCCM
OS dependencies ( .NET 3.5 vs .NET 4.5 )
prerequisites ( VCRT, .NET, Java, etc..)
Hardware requirements (x86 vs x64)
Lack of automation
EULA!?!?
AD Ware, unwanted packages, Malware! <shudder>
Install via EXE, MSI … <shudder> BAT, PS1…
What makes an App Packageable?
RULE: Provide the ability to install unattended
• /q /Silent /Quiet
/s
RULE: Do not display Blocking UI
• Are you really sure you want to install this package silently?
RULE: Do not exit until done, really done!
• Some Driver Packages, Office C2R.
RULE: No rebooting
• Exit code 3010 ERROR_SUCCESS_REBOOT_REQUIRED
Model Citizen: MSI Packages!
Demo
Getting more information…
Solution – App-V
Application Virtualization
Use Packaging tool to snapshot a Desktop App
Stream the application and Keep in a sandbox
Run Multiple versions of the same problem
Keep the dependencies in check
Now with better support in SCCM ?
App-V Client built-into Windows 10 RS1 ?
Solution – UWA
Universal Windows Apps (Metro … Modern … Store apps)
Runs on a wide range of platforms.
Windows Store for Business - makes UWA better.
• Download APPX files!
• License Mgmt!
New Solution – AppV + UWA
Combine:
• Application Virtualization (App-V)
• Universal Windows Apps (UWA)
Result: Project Centennial.
• Package Desktop Apps into Appx
• Available on Windows Store!
• AND *Extend* UWA API’s back
to Desktop apps.
State of the union
There is a lot of legacy, but a lot of new stuff.
Recommendations:
• Use MSI packages, and ask for them by name.
• Orca (Part of the Windows SDK)
• Others: Get info from http://ITNinja.com
Meanwhile…
Over on the developer side…
Visual Studio has NuGet
NUGET is a package manager for the
Microsoft “Development Platform” ( Visual Studio!)
Web Site: http://NuGet.org
Packages can be on NuGet.org (cloud), or your own (OnPrem)
The ecosystem is open source…
Microsoft has embraced the community with hooks in Visual Studio!
Demo
http://Nuget.org
PowerShell team embraces NuGet
PowerShellGet (Install-Module library)
Package Manager (Package-Manager-Manager)
AKA “OneGet”
Requires WMF 5.0
Demo
http://PowerShellGallery.com
Extend NuGet for regular apps?
Copy the Server code from NuGet
Copy the Website from NuGet
Tweak the NuGet installer to run PowerShell from the
Packages
Create some PowerShell helper functions
And…
http://Chocolatey.org is born <Yum>
The process
Download Chocolatey Toolkit (See website)
Run: choco.exe install <Package>
• Download <Package.nuget>
• Extract contents
• Call ChocolateyInstall.ps1
• ChocolateyInstall.ps1 calls Chocolatey functions to:
• Download Binaries
• Install programs
• Cleanup/Other Maintenance Tasks.
Demo
http://Chocolatey.org
Chocolatey with OneGet
Choco.exe works for Windows 7 and above.
For Windows Management Framework 5.0+ (Win10) Use OneGet.
Install packages using OneGet with Chocolatey Provider!
Available with Windows Management Framework 5.0 (Win 10)
Commands: Find-Package and Install-Package
Don’t forget to set ExecutionPolicy – RemoteSigned (minimum)
Use –ProviderName ‘Chocolatey’ to force right provider
Use –ForceBootStrap –Force –Verbose
Demo…
Demo
PowerShell and Chocolatey!
Creating a Chocolatey Package
PowerShell is what drives Chocolatey
• Incredible flexibility
• But… learning curve to get started
Steps:
• Create account on http://Chocolatey.org
• Create a PowerShell script to Install and UnInstall
• Define a *.XML NuGet style descriptor.
• Test, Package and Upload to http://Chocolatey.org
Moderation (a good thing)
Problem: *ANYONE* can post packages to Chocolatey.
Solution: Moderation of packages
Moderation process:
• Automated Tests – Static and Dynamic
• Manual review by designated “Moderators”
Packaging Gotchas
Working with other package owners
Versioning
• 10.0.26624.0 > 10.0.10586.0000
• Use --Version switch in Choco.exe to force version
Naming Conventions
Language Support
OS Dependencies
Chocolatey with MDT
Script – Install-Chocolatey.ps1 for MDT Litetouch
• Installs Chocolatey files in \MININT
https://keithga.wordpress.com/2014/11/25/new-toolchocolatey-wrapper-for-mdt/
The future
Chocolatey without PowerShell scripting?
Windows Update for Business
App-V on Windows Store ( Code Name Centennial )
Chocolatey? How will it evolve
Call to action - Q & A
Automation is your friend
Chocolatey is a great tool and/or resource for
automation!
Feeling inspired? Contribute!
Make your own Chocolatey Packages!
Thanks!
And Then …