Windows package manager

From Ever changing code

Chocolatey is a package manager for Windows like apt-get or yum but for Windows. With all of this in mind, think of Chocolatey as a framework that you can build on top of. Chef, Puppet, Boxstarter, PowerShell DSC, Ansible, Saltstack, etc all have ways for using Chocolatey to ensure the state of a computer and packages installed. Even Microsoft has decided to use Chocolatey's framework with the PowerShell PackageManagement / OneGet package manager aggregator.


#List execution policies
Get-ExecutionPolicy -List

#Windows Server 
Update-ExecutionPolicy -Policy Unrestricted

#Windows 10
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
Set-ExecutionPolicy Unrestricted -Scope LocalMachine

#Install Chocolatey
iex ((new-object net.webclient).DownloadString("")) 
#Reload profile
. $profile

# Explanation
alias iwr #Alias           iwr -> Invoke-WebRequest 
alias iex #Alias           iex -> Invoke-Expression


choco install <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>]
cinst <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>]

choco uninstall <pkg|all> [pkg2 pkgN] [options/switches]
cuninst <pkg|all> [pkg2 pkgN] [options/switches]

choco list --local-only

Install packages

Often packages require to run .ps1 installation steps and you will be prompted with: "The package sublimetext2 wants to run 'chocolateyInstall.ps1'. Note: If you don't run this script, the installation will fail. Note: To confirm automatically next time, use '-y' or consider: choco feature enable -n allowGlobalConfirmation.. So use commands to achieve this:

choco feature enable -n allowGlobalConfirmation #one time off
choco install -y notepadplusplus                #per package

cinst putty 7zip postman
choco install virtualbox
choco install minikube kubernetes-cli
cinst git-credential-manager-for-windows
cinst poshgit #git prompt in PowerShell teminal
cinst console-devel
cinst vscode notepadplusplus sublimetext2 atom #text editors
cinst vlc
cinst winmerge #add kdiff3
cinst googlechrome firefox
cinst sourcetree
cinst nodejs.install
cinst dotpeek
cinst fiddler4 #SSL packet inspection termination point and logging 
choco install dotnetcore-sdk            #.Net Core SDK
choco install dotnetcore-windowshosting #ASP.NET Core Module for IIS, enabling running of ASP.NET Core applications

#cinst git-credential-winstore #old use: Git Credential Manager for Windows

Install .net core

powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb ''))) <additional install-script args>"


Install IIS

Install IIS with PowerShell on Windows Server 2016 / VPS / 2019

# enable IIS role
Set-ExecutionPolicy Bypass -Scope Process
Get-WindowsOptionalFeature -Online | where FeatureName -like 'IIS-*' #check online for available features
Get-WindowsFeature -Name Web* | Where-Object Installed               #check installed web related features
Install-WindowsFeature -Name Web-Server -IncludeManagementTools
Install-WindowsFeature -Name Web-Server -IncludeManagementTools -IncludeAllSubFeature 
Disable-WindowsOptionalFeature -Online -FeatureName IIS-WebDAV       #disable IIS sub-feature (uninstall)

Windows desktop developer settings

#Set-WinUserLanguageList -LanguageList en-GB
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
#Set-StartScreenOptio=ns -EnableBootToDesktop
#Move-LibraryDirectory "Personal" "$env:UserProfile\<userName>\documents"
#Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -EnableOpenFileExplorerToQuickAccess -EnableShowRecentFilesInQuickAccess -EnableShowFrequentFoldersInQuickAccess -EnableExpandToOpenFolder
#Set-TaskbarOptions -Size Small -Lock -Dock Top -Combine Always
#Install-WindowsUpdate -AcceptEula