Installing software on a Windows server is a boring, but necessary process. Administrators can use the free package...
manager NuGet and package provider called Chocolatey to automate the task.
Chocolatey uses NuGet to bundle and distribute various software packages. Admins can enlist Chocolatey to install hundreds of different software packages with this single line in PowerShell:
But before any of this can happen, admins must install Chocolatey. To do so, open the PowerShell console and run the following command to download a PowerShell script from Chocolatey.org and invoke the script.
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
After Chocolatey installs, we can use the choco command to find, inspect, download and install software packages. For this article, let's say the admin wants to install the 7-zip utility on a server. Use the following command to search for available software:
choco search 7-Zip
Looking at the results in Figure 2, we want to install the 7zip 16.02.0.20160811 package. Pass that name to choco install and Chocolatey will download the file and begin the install.
In Figure 3, Chocolatey prompts the admin for permission to complete the installation. In the future, you can use the -y switch to suppress these warnings.
When removing programs installed by Chocolatey, don't use Programs and Features. Use choco with the uninstall parameter.
In Figure 4, notice the uninstall process was not silent. The admin has to click Uninstall, which is necessary when the package author does not include an automatic uninstall feature.
If a package does not have an automatic uninstall feature, you can build your own Chocolatey packages with that modification or create a new package for your organization's needs.
A choco search calls up several different packages that originate from the internet-hosted public community feed. If your company won't install "untrusted" software, create your own internal repository for Chocolatey to host packages; you also can download packages from the community feed and add them to your company's internal feed. Either way, the process is the same: Choose the source to use with the -source parameter:
choco 7zip -source myinternalfeed.company.local
With Chocolatey, you can automate software installations to remove a few time-consuming tasks from your list. Chocolatey and other NuGet-based package management technologies help reduce deployment time and any inadvertent errors that come with manual intervention.
SharePoint PowerShell commands help ease admin tasks
Use PowerShell DSC to build a web server
Manage Windows services with help from PowerShell and WMI