Welcome to the Chocolatey Community Package Repository! The packages found in this section of the site are provided, maintained, and moderated by the community.
Moderation
Every version of each package undergoes a rigorous moderation process before it goes live that typically includes:
- Security, consistency, and quality checking
- Installation testing
- Virus checking through VirusTotal
- Human moderators who give final review and sign off
More detail at Security and Moderation.
Organizational Use
If you are an organization using Chocolatey, we want your experience to be fully reliable. Due to the nature of this publicly offered repository, reliability cannot be guaranteed. Packages offered here are subject to distribution rights, which means they may need to reach out further to the internet to the official locations to download files at runtime.
Fortunately, distribution rights do not apply for internal use. With any edition of Chocolatey (including the free open source edition), you can host your own packages and cache or internalize existing community packages.
Disclaimer
Your use of the packages on this site means you understand they are not supported or guaranteed in any way. Learn more...
-
STEP1
Package Review
-
STEP2
Integration Method
-
STEP3
Internal Repo Url
-
STEP4
Environment Setup
-
STEP5
Install Script
Step 1: Review Your Packages
Step 2: Choose Your Integration Method
Step 3: Enter Your Internal Repository Url
(this should look similar to https://community.chocolatey.org/api/v2/)
Step 3: Copy Your Script or Download Config
Option 1: Copy Script
Option 2: Download Config
Step 4: Setup Your Environment
1. Ensure you are set for organizational deployment
Please see the organizational deployment guide
2. Get the package into your environment
Option 1: Cached Package (Unreliable, Requires Internet - Same As Community)-
Open Source or Commercial:
- Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
-
You can also just download the packages and push them to a repository
Download Packages
-
Open Source
-
Download the packages:
Download Packages - Follow manual internalization instructions
-
-
Package Internalizer (C4B)
-
Run: (additional options)
-
For package and dependencies run:
- Automate package internalization
-
Run: (additional options)
Step 5: Copy Your Script
See options you can pass to upgrade.
See best practices for scripting.
Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.
If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:
## 1. REQUIREMENTS ##
### Here are the requirements necessary to ensure this is successful.
### a. Internal/Private Cloud Repository Set Up ###
#### You'll need an internal/private cloud repository you can use. These are
#### generally really quick to set up and there are quite a few options.
#### Chocolatey Software recommends Nexus, Artifactory Pro, or ProGet as they
#### are repository servers and will give you the ability to manage multiple
#### repositories and types from one server installation.
### b. Download Chocolatey Package and Put on Internal Repository ###
#### You need to have downloaded the Chocolatey package as well.
#### Please see https://chocolatey.org/install#organization
### c. Other Requirements ###
#### We initialize a few things that are needed by this script - there are no other requirements.
$ErrorActionPreference = "Stop"
#### Set TLS 1.2 (3072) as that is the minimum required by various up-to-date repositories.
#### Use integers because the enumeration value for TLS 1.2 won't exist
#### in .NET 4.0, even though they are addressable if .NET 4.5+ is
#### installed (.NET 4.5 is an in-place upgrade).
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
#### We use this variable for future REST calls.
$RequestArguments = @{
UseBasicParsing = $true
}
## 2. TOP LEVEL VARIABLES ##
### a. Your internal repository url (the main one). ###
#### Should be similar to what you see when you browse
#### to https://community.chocolatey.org/api/v2/
$NugetRepositoryUrl = "INTERNAL REPO URL"
### b. Internal Repository Credential ###
#### If required, add the repository access credential here
# $NugetRepositoryCredential = [PSCredential]::new(
# "username",
# ("password" | ConvertTo-SecureString -AsPlainText -Force)
# )
# $RequestArguments.Credential = $NugetRepositoryCredential
### c. Chocolatey nupkg download url ###
#### This url should result in an immediate download when you navigate to it
$ChocolateyDownloadUrl = "$($NugetRepositoryUrl.TrimEnd('/'))/package/chocolatey.1.1.0.nupkg"
### d. Chocolatey Central Management (CCM) ###
#### If using CCM to manage Chocolatey, add the following:
#### i. Endpoint URL for CCM
# $ChocolateyCentralManagementUrl = "https://chocolatey-central-management:24020/ChocolateyManagementService"
#### ii. If using a Client Salt, add it here
# $ChocolateyCentralManagementClientSalt = "clientsalt"
#### iii. If using a Service Salt, add it here
# $ChocolateyCentralManagementServiceSalt = "servicesalt"
## 3. ENSURE CHOCOLATEY IS INSTALLED ##
### Ensure Chocolatey is installed from your internal repository
#### Download the Nupkg, appending .zip to the filename to handle archive cmdlet limitations
if (-not (Get-Command choco.exe -ErrorAction SilentlyContinue)) {
$TempDirectory = Join-Path $env:Temp "chocolateyInstall"
if (-not (Test-Path $TempDirectory -PathType Container)) {
$null = New-Item -Path $TempDirectory -ItemType Directory
}
$DownloadedNupkg = Join-Path $TempDirectory "$(Split-Path $ChocolateyDownloadUrl -Leaf).zip"
Invoke-WebRequest -Uri $ChocolateyDownloadUrl -OutFile $DownloadedNupkg @RequestArguments
#### Extract the Nupkg, and run the chocolateyInstall script
if (Get-Command Microsoft.PowerShell.Archive\Expand-Archive -ErrorAction SilentlyContinue) {
Microsoft.PowerShell.Archive\Expand-Archive -Path $DownloadedNupkg -DestinationPath $TempDirectory -Force
} else {
# PowerShell versions <4.0 do not have this function available
try {
$shellApplication = New-Object -ComObject Shell.Application
$zipPackage = $shellApplication.NameSpace($DownloadedNupkg)
$destinationFolder = $shellApplication.NameSpace($TempDirectory)
$destinationFolder.CopyHere($zipPackage.Items(), 0x10)
} catch {
Write-Warning "Unable to unzip package using built-in compression."
throw $_
}
}
& $(Join-Path $TempDirectory "tools\chocolateyInstall.ps1")
}
if (-not (Get-Command choco.exe -ErrorAction SilentlyContinue)) {
refreshenv
}
## 4. CONFIGURE CHOCOLATEY BASELINE ##
### a. FIPS Feature ###
#### If you need FIPS compliance - make this the first thing you configure
#### before you do any additional configuration or package installations
# choco feature enable -n useFipsCompliantChecksums
### b. Apply Recommended Configuration ###
#### Move cache location so Chocolatey is very deterministic about
#### cleaning up temporary data and the location is secured to admins
choco config set --name cacheLocation --value C:\ProgramData\chocolatey\cache
#### Increase timeout to at least 4 hours
choco config set --name commandExecutionTimeoutSeconds --value 14400
#### Turn off download progress when running choco through integrations
choco feature disable --name showDownloadProgress
### c. Sources ###
#### Remove the default community package repository source
choco source list --limitoutput | ConvertFrom-Csv -Header 'Name', 'Location' -Delimiter '|' | ForEach-Object {
if ($_.Location -eq 'https://community.chocolatey.org/api/v2/') {
choco source remove -n $_.Name
}
}
#### Add internal default sources
#### You could have multiple sources here, so we will provide an example
#### of one using the remote repo variable here
#### NOTE: This EXAMPLE may require changes
if ($NugetRepositoryCredential) {
choco source add --name ChocolateyInternal --source $NugetRepositoryUrl --user $NugetRepositoryCredential.UserName --password $NugetRepositoryCredential.GetNetworkCredential().Password --priority 1
} else {
choco source add --name ChocolateyInternal --source $NugetRepositoryUrl --priority 1
}
### b. Keep Chocolatey Up To Date ###
#### Keep chocolatey up to date based on your internal source
#### You control the upgrades based on when you push an updated version
#### to your internal repository.
#### Note the source here is to the OData feed, similar to what you see
#### when you browse to https://community.chocolatey.org/api/v2/
choco upgrade chocolatey --confirm
## 5. ENSURE CHOCOLATEY FOR BUSINESS ##
### If you don't have Chocolatey for Business (C4B), you'll want to remove from here down.
### a. Ensure The License File Is Installed ###
#### Create a license package using script from https://docs.chocolatey.org/en-us/how-tos/setup-offline-installation#exercise-4-create-a-package-for-the-license
choco install chocolatey-license --source $NugetRepositoryUrl --confirm
### b. Disable The Licensed Source ###
#### The licensed source cannot be removed, so it must be disabled.
#### This must occur after the license has been set by the license package.
if ("chocolatey-license" -in (choco list --localonly --limitoutput | ConvertFrom-Csv -Header "Name" -Delimiter "|").Name) {
choco source disable --name chocolatey.licensed
} else {
Write-Warning "Not disabling 'chocolatey.licensed' feed, as Chocolatey-License has not been installed."
}
### c. Ensure Chocolatey Licensed Extension ###
#### You will have downloaded the licensed extension to your internal repository
#### as you have disabled the licensed repository in step 5b.
#### Ensure the chocolatey.extension package (aka Chocolatey Licensed Extension)
if ("chocolatey-license" -in (choco list --localonly --limitoutput | ConvertFrom-Csv -Header "Name" -Delimiter "|").Name) {
choco install chocolatey.extension --source $NugetRepositoryUrl --confirm
} else {
Write-Warning "Not installing 'chocolatey.extension', as Chocolatey-License has not been installed."
}
#### The Chocolatey Licensed Extension unlocks all of the following, which also have configuration/feature items available with them. You may want to visit the feature pages to see what you might want to also enable:
#### - Package Builder - https://docs.chocolatey.org/en-us/features/paid/package-builder
#### - Package Internalizer - https://docs.chocolatey.org/en-us/features/paid/package-internalizer
#### - Package Synchronization (3 components) - https://docs.chocolatey.org/en-us/features/paid/package-synchronization
#### - Package Reducer - https://docs.chocolatey.org/en-us/features/paid/package-reducer
#### - Package Audit - https://docs.chocolatey.org/en-us/features/paid/package-audit
#### - Package Throttle - https://docs.chocolatey.org/en-us/features/paid/package-throttle
#### - CDN Cache Access - https://docs.chocolatey.org/en-us/features/paid/private-cdn
#### - Branding - https://docs.chocolatey.org/en-us/features/paid/branding
#### - Self-Service Anywhere (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/self-service-anywhere
#### - Chocolatey Central Management (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/chocolatey-central-management
#### - Other - https://docs.chocolatey.org/en-us/features/paid/
### d. Ensure Self-Service Anywhere ###
#### If you have desktop clients where users are not administrators, you may
#### to take advantage of deploying and configuring Self-Service anywhere
choco feature disable --name showNonElevatedWarnings
choco feature enable --name useBackgroundService
choco feature enable --name useBackgroundServiceWithNonAdministratorsOnly
choco feature enable --name allowBackgroundServiceUninstallsFromUserInstallsOnly
choco config set --name allowedBackgroundServiceCommands --value "install,upgrade,uninstall"
### e. Ensure Chocolatey Central Management ###
#### If you want to manage and report on endpoints, you can set up and configure
### Central Management. There are multiple portions to manage, so you'll see
### a section on agents here along with notes on how to configure the server
### side components.
if ($ChocolateyCentralManagementUrl) {
choco install chocolatey-agent --source $NugetRepositoryUrl --confirm
choco config set --name CentralManagementServiceUrl --value $ChocolateyCentralManagementUrl
if ($ChocolateyCentralManagementClientSalt) {
choco config set --name centralManagementClientCommunicationSaltAdditivePassword --value $ChocolateyCentralManagementClientSalt
}
if ($ChocolateyCentralManagementServiceSalt) {
choco config set --name centralManagementServiceCommunicationSaltAdditivePassword --value $ChocolateyCentralManagementServiceSalt
}
choco feature enable --name useChocolateyCentralManagement
choco feature enable --name useChocolateyCentralManagementDeployments
}
See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.
If Applicable - Chocolatey Configuration/Installation
## 1. REQUIREMENTS ##
### Here are the requirements necessary to ensure this is successful.
### a. Internal/Private Cloud Repository Set Up ###
#### You'll need an internal/private cloud repository you can use. These are
#### generally really quick to set up and there are quite a few options.
#### Chocolatey Software recommends Nexus, Artifactory Pro, or ProGet as they
#### are repository servers and will give you the ability to manage multiple
#### repositories and types from one server installation.
### b. Download Chocolatey Package and Put on Internal Repository ###
#### You need to have downloaded the Chocolatey package as well.
#### Please see https://chocolatey.org/install#organization
### c. Other Requirements ###
#### i. chocolatey.chocolatey
##### You will require the chocolatey.chocolatey collection to be installed
##### on all machines using this playbook.
##### Please see https://github.com/chocolatey/chocolatey-ansible/#installing-the-collection-from-ansible-galaxy
- name: Install and Configure Chocolatey
hosts: all
## 2. TOP LEVEL VARIABLES ##
vars:
### a. Your internal repository url (the main one). ###
#### Should be similar to what you see when you browse
#### to https://community.chocolatey.org/api/v2/
nuget_repository_url: INTERNAL REPO URL
### b. Internal Repository Credential ###
#### If required, add the repository access credential here and
#### uncomment lines with source_username and source_password below
# nuget_repository_username: username
# nuget_repository_password: password
### c. Chocolatey Central Management (CCM) ###
#### If using CCM to manage Chocolatey, add the following:
#### i. Endpoint URL for CCM
# chocolatey_central_management_url: https://chocolatey-central-management:24020/ChocolateyManagementService
#### ii. If using a Client Salt, add it here
# chocolatey_central_management_client_salt: clientsalt
#### iii. If using a Service Salt, add it here
# chocolatey_central_management_service_salt: servicesalt
## 3. ENSURE CHOCOLATEY IS INSTALLED ##
### Ensure Chocolatey is installed from your internal repository
tasks:
- name: Install chocolatey
win_chocolatey:
name: chocolatey
source: {{ nuget_repository_url }}
# source_username: {{ nuget_repository_username }}
# source_password: {{ nuget_repository_password }}
## 4. CONFIGURE CHOCOLATEY BASELINE ##
### a. FIPS Feature ###
#### If you need FIPS compliance - make this the first thing you configure
#### before you do any additional configuration or package installations
# - name: Enable FIPS compliance
# win_chocolatey_feature:
# name: useFipsCompliantChecksums
# state: enabled
### b. Apply Recommended Configuration ###
#### Move cache location so Chocolatey is very deterministic about
#### cleaning up temporary data and the location is secured to admins
- name: Set the cache location
win_chocolatey_config:
name: cacheLocation
state: present
value: C:\ProgramData\chocolatey\cache
#### Increase timeout to at least 4 hours
- name: Set the command execution timeout
win_chocolatey_config:
name: commandExecutionTimeoutSeconds
state: present
value: 14400
#### Turn off download progress when running choco through integrations
- name: Disable showing download progress
win_chocolatey_feature:
name: showDownloadProgress
state: disabled
### c. Sources ###
#### Remove the default community package repository source
- name: Remove Chocolatey Community Repository
win_chocolatey_source:
name: chocolatey
state: absent
#### Add internal default sources
#### You could have multiple sources here, so we will provide an example
#### of one using the remote repo variable here
#### NOTE: This EXAMPLE may require changes
- name: Add Internal Repository
win_chocolatey_source:
name: ChocolateyInternal
state: present
source: {{ nuget_repository_url }}
# source_username: {{ nuget_repository_username }}
# source_password: {{ nuget_repository_password }}
priority: 1
### b. Keep Chocolatey Up To Date ###
#### Keep chocolatey up to date based on your internal source
#### You control the upgrades based on when you push an updated version
#### to your internal repository.
#### Note the source here is to the OData feed, similar to what you see
#### when you browse to https://community.chocolatey.org/api/v2/
- name: Upgrade Chocolatey
win_chocolatey:
name: chocolatey
state: latest
## 5. ENSURE CHOCOLATEY FOR BUSINESS ##
### If you don't have Chocolatey for Business (C4B), you'll want to remove from here down.
### a. Ensure The License File Is Installed ###
#### Create a license package using script from https://docs.chocolatey.org/en-us/how-tos/setup-offline-installation#exercise-4-create-a-package-for-the-license
- name: Install Chocolatey License
win_chocolatey:
name: chocolatey-license
source: ChocolateyInternal
state: latest
### b. Disable The Licensed Source ###
#### The licensed source cannot be removed, so it must be disabled.
#### This must occur after the license has been set by the license package.
- name: Disable Chocolatey Community Repository
win_chocolatey_source:
name: chocolatey.licensed
state: disabled
### c. Ensure Chocolatey Licensed Extension ###
#### You will have downloaded the licensed extension to your internal repository
#### as you have disabled the licensed repository in step 5b.
#### Ensure the chocolatey.extension package (aka Chocolatey Licensed Extension)
- name: Install Chocolatey Extension
win_chocolatey:
name: chocolatey.extension
source: ChocolateyInternal
state: latest
#### The Chocolatey Licensed Extension unlocks all of the following, which also have configuration/feature items available with them. You may want to visit the feature pages to see what you might want to also enable:
#### - Package Builder - https://docs.chocolatey.org/en-us/features/paid/package-builder
#### - Package Internalizer - https://docs.chocolatey.org/en-us/features/paid/package-internalizer
#### - Package Synchronization (3 components) - https://docs.chocolatey.org/en-us/features/paid/package-synchronization
#### - Package Reducer - https://docs.chocolatey.org/en-us/features/paid/package-reducer
#### - Package Audit - https://docs.chocolatey.org/en-us/features/paid/package-audit
#### - Package Throttle - https://docs.chocolatey.org/en-us/features/paid/package-throttle
#### - CDN Cache Access - https://docs.chocolatey.org/en-us/features/paid/private-cdn
#### - Branding - https://docs.chocolatey.org/en-us/features/paid/branding
#### - Self-Service Anywhere (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/self-service-anywhere
#### - Chocolatey Central Management (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/chocolatey-central-management
#### - Other - https://docs.chocolatey.org/en-us/features/paid/
### d. Ensure Self-Service Anywhere ###
#### If you have desktop clients where users are not administrators, you may
#### to take advantage of deploying and configuring Self-Service anywhere
- name: Hide not-elevated warnings
win_chocolatey_feature:
name: showNonElevatedWarnings
state: disabled
- name: Use background mode for self-service
win_chocolatey_feature:
name: useBackgroundService
state: enabled
- name: Use background service for non-admins
win_chocolatey_feature:
name: useBackgroundServiceWithNonAdministratorsOnly
state: enabled
- name: Allow background uninstallation for user installs
win_chocolatey_feature:
name: allowBackgroundServiceUninstallsFromUserInstallsOnly
state: enabled
- name: Set allowed background service commands
win_chocolatey_config:
name: backgroundServiceAllowedCommands
state: present
value: install,upgrade,uninstall
### e. Ensure Chocolatey Central Management ###
#### If you want to manage and report on endpoints, you can set up and configure
### Central Management. There are multiple portions to manage, so you'll see
### a section on agents here along with notes on how to configure the server
### side components.
- name: Install Chocolatey Agent
when: chocolatey_central_management_url is defined
win_chocolatey:
name: chocolatey-agent
source: ChocolateyInternal
state: latest
- name: Set the Central Management Service URL
when: chocolatey_central_management_url is defined
win_chocolatey_config:
name: CentralManagementServiceUrl
state: present
value: {{ chocolatey_central_management_url }}
- name: Set the Central Management Client Salt
when: chocolatey_central_management_client_salt is defined
win_chocolatey_config:
name: centralManagementClientCommunicationSaltAdditivePassword
state: present
value: {{ chocolatey_central_management_client_salt }}
- name: Set the Central Management Service Salt
when: chocolatey_central_management_service_salt is defined
win_chocolatey_config:
name: centralManagementServiceCommunicationSaltAdditivePassword
state: present
value: {{ chocolatey_central_management_service_salt }}
- name: Use Central Management
when: chocolatey_central_management_url is defined
win_chocolatey_feature:
name: useChocolateyCentralManagement
state: enabled
- name: Use Central Management Deployments
when: chocolatey_central_management_url is defined
win_chocolatey_feature:
name: useChocolateyCentralManagementDeployments
state: enabled
See docs at https://docs.chef.io/resource_chocolatey_package.html.
If Applicable - Chocolatey Configuration/Installation
## 1. REQUIREMENTS ##
### Here are the requirements necessary to ensure this is successful.
### a. Internal/Private Cloud Repository Set Up ###
#### You'll need an internal/private cloud repository you can use. These are
#### generally really quick to set up and there are quite a few options.
#### Chocolatey Software recommends Nexus, Artifactory Pro, or ProGet as they
#### are repository servers and will give you the ability to manage multiple
#### repositories and types from one server installation.
### b. Download Chocolatey Package and Put on Internal Repository ###
#### You need to have downloaded the Chocolatey package as well.
#### Please see https://chocolatey.org/install#organization
### c. Other Requirements ###
#### The Chocolatey resources are available with any recent version of Chef.
#### We utilise the Chocolatey recipe to install the Chocolatey binaries.
include_recipe "chocolatey"
## 2. TOP LEVEL VARIABLES ##
### a. Your internal repository url (the main one). ###
#### Should be similar to what you see when you browse
#### to https://community.chocolatey.org/api/v2/
NugetRepositoryUrl = "INTERNAL REPO URL"
### b. Internal Repository Credential ###
#### If required, add the repository access credential here
# NugetRepositoryUsername = "username"
# NugetRepositoryPassword = "password"
### c. Chocolatey nupkg download url ###
#### This url should result in an immediate download when you navigate to it in
#### a web browser
ChocolateyNupkgUrl = "INTERNAL REPO URL/package/chocolatey.1.1.0.nupkg",
### d. Chocolatey Central Management (CCM) ###
#### If using CCM to manage Chocolatey, add the following:
#### i. Endpoint URL for CCM
# ChocolateyCentralManagementUrl = "https://chocolatey-central-management:24020/ChocolateyManagementService"
#### ii. If using a Client Salt, add it here
# ChocolateyCentralManagementClientSalt = "clientsalt"
#### iii. If using a Service Salt, add it here
# ChocolateyCentralManagementServiceSalt = "servicesalt"
## 3. ENSURE CHOCOLATEY IS INSTALLED ##
### Ensure Chocolatey is installed from your internal repository
node['chocolatey']['install vars'] = {
'chocolateyDownloadUrl' => "#{ChocolateyNupkgUrl}",
}
## 4. CONFIGURE CHOCOLATEY BASELINE ##
### a. FIPS Feature ###
#### If you need FIPS compliance - make this the first thing you configure
#### before you do any additional configuration or package installations
# chocolatey_feature 'useFipsCompliantChecksums' do
# action :enable
# end
### b. Apply Recommended Configuration ###
#### Move cache location so Chocolatey is very deterministic about
#### cleaning up temporary data and the location is secured to admins
chocolatey_config 'cacheLocation' do
value 'C:\ProgramData\chocolatey\cache'
end
#### Increase timeout to at least 4 hours
chocolatey_config 'commandExecutionTimeoutSeconds' do
value '14400'
end
#### Turn off download progress when running choco through integrations
chocolatey_feature 'showDownloadProgress' do
action :disable
end
### c. Sources ###
#### Remove the default community package repository source
chocolatey_source 'chocolatey' do
action :remove
end
#### Add internal default sources
#### You could have multiple sources here, so we will provide an example
#### of one using the remote repo variable here
#### NOTE: This EXAMPLE may require changes
chocolatey_source 'ChocolateyInternal' do
source "#{NugetRepositoryUrl}"
priority 1
action :add
end
execute 'ChocolateyInternal' do
command "choco source add --name ChocolateyInternal -s #{NugetRepositoryUrl} -u=#{NugetRepositoryUsername} -p=#{NugetRepositoryPassword} --priority=1"
only_if { NugetRepositoryUsername != nil || NugetRepositoryPassword != nil }
end
### b. Keep Chocolatey Up To Date ###
#### Keep chocolatey up to date based on your internal source
#### You control the upgrades based on when you push an updated version
#### to your internal repository.
#### Note the source here is to the OData feed, similar to what you see
#### when you browse to https://community.chocolatey.org/api/v2/
chocolatey_package 'chocolatey' do
action :upgrade
source "#{NugetRepositoryUrl}"
end
## 5. ENSURE CHOCOLATEY FOR BUSINESS ##
### If you don't have Chocolatey for Business (C4B), you'll want to remove from here down.
### a. Ensure The License File Is Installed ###
#### Create a license package using script from https://docs.chocolatey.org/en-us/how-tos/setup-offline-installation#exercise-4-create-a-package-for-the-license
chocolatey_package 'chocolatey-license' do
action :install
source "#{NugetRepositoryUrl}"
end
### b. Disable The Licensed Source ###
#### The licensed source cannot be removed, so it must be disabled.
#### This must occur after the license has been set by the license package.
chocolatey_source 'chocolatey.licensed' do
action :disable
end
### c. Ensure Chocolatey Licensed Extension ###
#### You will have downloaded the licensed extension to your internal repository
#### as you have disabled the licensed repository in step 5b.
#### Ensure the chocolatey.extension package (aka Chocolatey Licensed Extension)
chocolatey_package 'chocolatey.extention' do
action install
source "#{NugetRepositoryUrl}"
end
#### The Chocolatey Licensed Extension unlocks all of the following, which also have configuration/feature items available with them. You may want to visit the feature pages to see what you might want to also enable:
#### - Package Builder - https://docs.chocolatey.org/en-us/features/paid/package-builder
#### - Package Internalizer - https://docs.chocolatey.org/en-us/features/paid/package-internalizer
#### - Package Synchronization (3 components) - https://docs.chocolatey.org/en-us/features/paid/package-synchronization
#### - Package Reducer - https://docs.chocolatey.org/en-us/features/paid/package-reducer
#### - Package Audit - https://docs.chocolatey.org/en-us/features/paid/package-audit
#### - Package Throttle - https://docs.chocolatey.org/en-us/features/paid/package-throttle
#### - CDN Cache Access - https://docs.chocolatey.org/en-us/features/paid/private-cdn
#### - Branding - https://docs.chocolatey.org/en-us/features/paid/branding
#### - Self-Service Anywhere (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/self-service-anywhere
#### - Chocolatey Central Management (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/chocolatey-central-management
#### - Other - https://docs.chocolatey.org/en-us/features/paid/
### d. Ensure Self-Service Anywhere ###
#### If you have desktop clients where users are not administrators, you may
#### to take advantage of deploying and configuring Self-Service anywhere
chocolatey_feature 'showNonElevatedWarnings' do
action :disable
end
chocolatey_feature 'useBackgroundService' do
action :enable
end
chocolatey_feature 'useBackgroundServiceWithNonAdministratorsOnly' do
action :enable
end
chocolatey_feature 'allowBackgroundServiceUninstallsFromUserInstallsOnly' do
action :enable
end
chocolatey_config 'backgroundServiceAllowedCommands' do
value 'install,upgrade,uninstall'
end
### e. Ensure Chocolatey Central Management ###
#### If you want to manage and report on endpoints, you can set up and configure
### Central Management. There are multiple portions to manage, so you'll see
### a section on agents here along with notes on how to configure the server
### side components.
chocolatey_package 'chocolatey-agent' do
action install
source "#{NugetRepositoryUrl}"
# user "#{NugetRepositoryUsername}"
# password "#{NugetRepositoryPassword}"
only_if { ChocolateyCentralManagementUrl != nil }
end
chocolatey_config 'CentralManagementServiceUrl' do
value "#{ChocolateyCentralManagementUrl}"
only_if { ChocolateyCentralManagementUrl != nil }
end
chocolatey_config 'centralManagementClientCommunicationSaltAdditivePassword' do
value "#{ChocolateyCentralManagementClientSalt}"
only_if { ChocolateyCentralManagementClientSalt != nil }
end
chocolatey_config 'centralManagementServiceCommunicationSaltAdditivePassword' do
value "#{ChocolateyCentralManagementServiceSalt}"
only_if { ChocolateyCentralManagementServiceSalt != nil }
end
chocolatey_feature 'useChocolateyCentralManagement' do
action :enable
only_if { ChocolateyCentralManagementUrl != nil }
end
chocolatey_feature 'useChocolateyCentralManagementDeployments' do
action :enable
only_if { ChocolateyCentralManagementUrl != nil }
end
Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.
If Applicable - Chocolatey Configuration/Installation
#requires -Modules cChoco
## 1. REQUIREMENTS ##
### Here are the requirements necessary to ensure this is successful.
### a. Internal/Private Cloud Repository Set Up ###
#### You'll need an internal/private cloud repository you can use. These are
#### generally really quick to set up and there are quite a few options.
#### Chocolatey Software recommends Nexus, Artifactory Pro, or ProGet as they
#### are repository servers and will give you the ability to manage multiple
#### repositories and types from one server installation.
### b. Download Chocolatey Package and Put on Internal Repository ###
#### You need to have downloaded the Chocolatey package as well.
#### Please see https://chocolatey.org/install#organization
### c. Other Requirements ###
#### i. Requires chocolatey\cChoco DSC module to be installed on the machine compiling the DSC manifest
#### NOTE: This will need to be installed before running the DSC portion of this script
if (-not (Get-Module cChoco -ListAvailable)) {
$null = Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
if (($PSGallery = Get-PSRepository -Name PSGallery).InstallationPolicy -ne "Trusted") {
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
}
Install-Module -Name cChoco
if ($PSGallery.InstallationPolicy -ne "Trusted") {
Set-PSRepository -Name PSGallery -InstallationPolicy $PSGallery.InstallationPolicy
}
}
#### ii. Requires a hosted copy of the install.ps1 script
##### This should be available to download without authentication.
##### The original script can be found here: https://community.chocolatey.org/install.ps1
Configuration ChocolateyConfig {
## 2. TOP LEVEL VARIABLES ##
param(
### a. Your internal repository url (the main one). ###
#### Should be similar to what you see when you browse
#### to https://community.chocolatey.org/api/v2/
$NugetRepositoryUrl = "INTERNAL REPO URL",
### b. Chocolatey nupkg download url ###
#### This url should result in an immediate download when you navigate to it in
#### a web browser
$ChocolateyNupkgUrl = "INTERNAL REPO URL/package/chocolatey.1.1.0.nupkg",
### c. Internal Repository Credential ###
#### If required, add the repository access credential here
# $NugetRepositoryCredential = [PSCredential]::new(
# "username",
# ("password" | ConvertTo-SecureString -AsPlainText -Force)
# ),
### d. Install.ps1 URL
#### The path to the hosted install script:
$ChocolateyInstallPs1Url = "https://community.chocolatey.org/install.ps1"
### e. Chocolatey Central Management (CCM) ###
#### If using CCM to manage Chocolatey, add the following:
#### i. Endpoint URL for CCM
# $ChocolateyCentralManagementUrl = "https://chocolatey-central-management:24020/ChocolateyManagementService",
#### ii. If using a Client Salt, add it here
# $ChocolateyCentralManagementClientSalt = "clientsalt",
#### iii. If using a Service Salt, add it here
# $ChocolateyCentralManagementServiceSalt = "servicesalt"
)
Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName cChoco
Node 'localhost' {
## 3. ENSURE CHOCOLATEY IS INSTALLED ##
### Ensure Chocolatey is installed from your internal repository
Environment chocoDownloadUrl {
Name = "chocolateyDownloadUrl"
Value = $ChocolateyNupkgUrl
}
cChocoInstaller installChocolatey {
DependsOn = "[Environment]chocoDownloadUrl"
InstallDir = Join-Path $env:ProgramData "chocolatey"
ChocoInstallScriptUrl = $ChocolateyInstallPs1Url
}
## 4. CONFIGURE CHOCOLATEY BASELINE ##
### a. FIPS Feature ###
#### If you need FIPS compliance - make this the first thing you configure
#### before you do any additional configuration or package installations
# cChocoFeature featureFipsCompliance {
# FeatureName = "useFipsCompliantChecksums"
# }
### b. Apply Recommended Configuration ###
#### Move cache location so Chocolatey is very deterministic about
#### cleaning up temporary data and the location is secured to admins
cChocoConfig cacheLocation {
DependsOn = "[cChocoInstaller]installChocolatey"
ConfigName = "cacheLocation"
Value = "C:\ProgramData\chocolatey\cache"
}
#### Increase timeout to at least 4 hours
cChocoConfig commandExecutionTimeoutSeconds {
DependsOn = "[cChocoInstaller]installChocolatey"
ConfigName = "commandExecutionTimeoutSeconds"
Value = 14400
}
#### Turn off download progress when running choco through integrations
cChocoFeature showDownloadProgress {
DependsOn = "[cChocoInstaller]installChocolatey"
FeatureName = "showDownloadProgress"
Ensure = "Absent"
}
### c. Sources ###
#### Remove the default community package repository source
cChocoSource removeCommunityRepository {
DependsOn = "[cChocoInstaller]installChocolatey"
Name = "chocolatey"
Ensure = "Absent"
}
#### Add internal default sources
#### You could have multiple sources here, so we will provide an example
#### of one using the remote repo variable here.
#### NOTE: This EXAMPLE may require changes
cChocoSource addInternalSource {
DependsOn = "[cChocoInstaller]installChocolatey"
Name = "ChocolateyInternal"
Source = $NugetRepositoryUrl
Credentials = $NugetRepositoryCredential
Priority = 1
}
### b. Keep Chocolatey Up To Date ###
#### Keep chocolatey up to date based on your internal source
#### You control the upgrades based on when you push an updated version
#### to your internal repository.
#### Note the source here is to the OData feed, similar to what you see
#### when you browse to https://community.chocolatey.org/api/v2/
cChocoPackageInstaller updateChocolatey {
DependsOn = "[cChocoSource]addInternalSource", "[cChocoSource]removeCommunityRepository"
Name = "chocolatey"
AutoUpgrade = $true
}
## 5. ENSURE CHOCOLATEY FOR BUSINESS ##
### If you don't have Chocolatey for Business (C4B), you'll want to remove from here down.
### a. Ensure The License File Is Installed ###
#### Create a license package using script from https://docs.chocolatey.org/en-us/how-tos/setup-offline-installation#exercise-4-create-a-package-for-the-license
cChocoPackageInstaller chocolateyLicense {
DependsOn = "[cChocoPackageInstaller]updateChocolatey"
Name = "chocolatey-license"
}
### b. Disable The Licensed Source ###
#### The licensed source cannot be removed, so it must be disabled.
#### This must occur after the license has been set by the license package.
Script disableLicensedSource {
DependsOn = "[cChocoPackageInstaller]chocolateyLicense"
GetScript = {
$Source = choco source list --limitoutput | `
ConvertFrom-Csv -Delimiter '|' -Header Name, Source, Disabled | `
Where-Object Name -eq "chocolatey.licensed"
return @{
Result = if ($Source) {
[bool]::Parse($Source.Disabled)
} else {
Write-Warning "Source 'chocolatey.licensed' was not present."
$true # Source does not need disabling
}
}
}
SetScript = {
$null = choco source disable --name "chocolatey.licensed"
}
TestScript = {
$State = [ScriptBlock]::Create($GetScript).Invoke()
return $State.Result
}
}
### c. Ensure Chocolatey Licensed Extension ###
#### You will have downloaded the licensed extension to your internal repository
#### as you have disabled the licensed repository in step 5b.
#### Ensure the chocolatey.extension package (aka Chocolatey Licensed Extension)
cChocoPackageInstaller chocolateyLicensedExtension {
DependsOn = "[Script]disableLicensedSource"
Name = "chocolatey.extension"
}
#### The Chocolatey Licensed Extension unlocks all of the following, which also have configuration/feature items available with them. You may want to visit the feature pages to see what you might want to also enable:
#### - Package Builder - https://docs.chocolatey.org/en-us/features/paid/package-builder
#### - Package Internalizer - https://docs.chocolatey.org/en-us/features/paid/package-internalizer
#### - Package Synchronization (3 components) - https://docs.chocolatey.org/en-us/features/paid/package-synchronization
#### - Package Reducer - https://docs.chocolatey.org/en-us/features/paid/package-reducer
#### - Package Audit - https://docs.chocolatey.org/en-us/features/paid/package-audit
#### - Package Throttle - https://docs.chocolatey.org/en-us/features/paid/package-throttle
#### - CDN Cache Access - https://docs.chocolatey.org/en-us/features/paid/private-cdn
#### - Branding - https://docs.chocolatey.org/en-us/features/paid/branding
#### - Self-Service Anywhere (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/self-service-anywhere
#### - Chocolatey Central Management (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/chocolatey-central-management
#### - Other - https://docs.chocolatey.org/en-us/features/paid/
### d. Ensure Self-Service Anywhere ###
#### If you have desktop clients where users are not administrators, you may
#### to take advantage of deploying and configuring Self-Service anywhere
cChocoFeature hideElevatedWarnings {
DependsOn = "[cChocoPackageInstaller]chocolateyLicensedExtension"
FeatureName = "showNonElevatedWarnings"
Ensure = "Absent"
}
cChocoFeature useBackgroundService {
DependsOn = "[cChocoPackageInstaller]chocolateyLicensedExtension"
FeatureName = "useBackgroundService"
Ensure = "Present"
}
cChocoFeature useBackgroundServiceWithNonAdmins {
DependsOn = "[cChocoPackageInstaller]chocolateyLicensedExtension"
FeatureName = "useBackgroundServiceWithNonAdministratorsOnly"
Ensure = "Present"
}
cChocoFeature useBackgroundServiceUninstallsForUserInstalls {
DependsOn = "[cChocoPackageInstaller]chocolateyLicensedExtension"
FeatureName = "allowBackgroundServiceUninstallsFromUserInstallsOnly"
Ensure = "Present"
}
cChocoConfig allowedBackgroundServiceCommands {
DependsOn = "[cChocoFeature]useBackgroundService"
ConfigName = "backgroundServiceAllowedCommands"
Value = "install,upgrade,uninstall"
}
### e. Ensure Chocolatey Central Management ###
#### If you want to manage and report on endpoints, you can set up and configure
### Central Management. There are multiple portions to manage, so you'll see
### a section on agents here along with notes on how to configure the server
### side components.
if ($ChocolateyCentralManagementUrl) {
cChocoPackageInstaller chocolateyAgent {
DependsOn = "[cChocoPackageInstaller]chocolateyLicensedExtension"
Name = "chocolatey-agent"
}
cChocoConfig centralManagementServiceUrl {
DependsOn = "[cChocoPackageInstaller]chocolateyAgent"
ConfigName = "CentralManagementServiceUrl"
Value = $ChocolateyCentralManagementUrl
}
if ($ChocolateyCentralManagementClientSalt) {
cChocoConfig centralManagementClientSalt {
DependsOn = "[cChocoPackageInstaller]chocolateyAgent"
ConfigName = "centralManagementClientCommunicationSaltAdditivePassword"
Value = $ChocolateyCentralManagementClientSalt
}
}
if ($ChocolateyCentralManagementServiceSalt) {
cChocoConfig centralManagementServiceSalt {
DependsOn = "[cChocoPackageInstaller]chocolateyAgent"
ConfigName = "centralManagementServiceCommunicationSaltAdditivePassword"
Value = $ChocolateyCentralManagementServiceSalt
}
}
cChocoFeature useCentralManagement {
DependsOn = "[cChocoPackageInstaller]chocolateyAgent"
FeatureName = "useChocolateyCentralManagement"
Ensure = "Present"
}
cChocoFeature useCentralManagementDeployments {
DependsOn = "[cChocoPackageInstaller]chocolateyAgent"
FeatureName = "useChocolateyCentralManagementDeployments"
Ensure = "Present"
}
}
}
}
# If working this into an existing configuration with a good method for
$ConfigData = @{
AllNodes = @(
@{
NodeName = "localhost"
PSDscAllowPlainTextPassword = $true
}
)
}
try {
Push-Location $env:Temp
$Config = ChocolateyConfig -ConfigurationData $ConfigData
Start-DscConfiguration -Path $Config.PSParentPath -Wait -Verbose -Force
} finally {
Pop-Location
}
Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.
If Applicable - Chocolatey Configuration/Installation
## 1. REQUIREMENTS ##
### Here are the requirements necessary to ensure this is successful.
### a. Internal/Private Cloud Repository Set Up ###
#### You'll need an internal/private cloud repository you can use. These are
#### generally really quick to set up and there are quite a few options.
#### Chocolatey Software recommends Nexus, Artifactory Pro, or ProGet as they
#### are repository servers and will give you the ability to manage multiple
#### repositories and types from one server installation.
### b. Download Chocolatey Package and Put on Internal Repository ###
#### You need to have downloaded the Chocolatey package as well.
#### Please see https://chocolatey.org/install#organization
### c. Other Requirements ###
#### i. Requires puppetlabs/chocolatey module
#### See https://forge.puppet.com/puppetlabs/chocolatey
## 2. TOP LEVEL VARIABLES ##
### a. Your internal repository url (the main one). ###
#### Should be similar to what you see when you browse
#### to https://community.chocolatey.org/api/v2/
$_repository_url = 'INTERNAL REPO URL'
### b. Chocolatey nupkg download url ###
#### This url should result in an immediate download when you navigate to it in
#### a web browser
$_choco_download_url = 'INTERNAL REPO URL/package/chocolatey.1.1.0.nupkg'
### c. Chocolatey Central Management (CCM) ###
#### If using CCM to manage Chocolatey, add the following:
#### i. Endpoint URL for CCM
# $_chocolatey_central_management_url = 'https://chocolatey-central-management:24020/ChocolateyManagementService'
#### ii. If using a Client Salt, add it here
# $_chocolatey_central_management_client_salt = "clientsalt"
#### iii. If using a Service Salt, add it here
# $_chocolatey_central_management_service_salt = 'servicesalt'
## 3. ENSURE CHOCOLATEY IS INSTALLED ##
### Ensure Chocolatey is installed from your internal repository
### Note: `chocolatey_download_url is completely different than normal
### source locations. This is directly to the bare download url for the
### chocolatey.nupkg, similar to what you see when you browse to
### https://community.chocolatey.org/api/v2/package/chocolatey
class {'chocolatey':
chocolatey_download_url => $_choco_download_url,
use_7zip => false,
}
## 4. CONFIGURE CHOCOLATEY BASELINE ##
### a. FIPS Feature ###
#### If you need FIPS compliance - make this the first thing you configure
#### before you do any additional configuration or package installations
#chocolateyfeature {'useFipsCompliantChecksums':
# ensure => enabled,
#}
### b. Apply Recommended Configuration ###
#### Move cache location so Chocolatey is very deterministic about
#### cleaning up temporary data and the location is secured to admins
chocolateyconfig {'cacheLocation':
value => 'C:\ProgramData\chocolatey\cache',
}
#### Increase timeout to at least 4 hours
chocolateyconfig {'commandExecutionTimeoutSeconds':
value => '14400',
}
#### Turn off download progress when running choco through integrations
chocolateyfeature {'showDownloadProgress':
ensure => disabled,
}
### c. Sources ###
#### Remove the default community package repository source
chocolateysource {'chocolatey':
ensure => absent,
location => 'https://community.chocolatey.org/api/v2/',
}
#### Add internal default sources
#### You could have multiple sources here, so we will provide an example
#### of one using the remote repo variable here
#### NOTE: This EXAMPLE requires changes
chocolateysource {'internal_chocolatey':
ensure => present,
location => $_repository_url,
priority => 1,
username => 'optional',
password => 'optional,not ensured',
bypass_proxy => true,
admin_only => false,
allow_self_service => false,
}
### b. Keep Chocolatey Up To Date ###
#### Keep chocolatey up to date based on your internal source
#### You control the upgrades based on when you push an updated version
#### to your internal repository.
#### Note the source here is to the OData feed, similar to what you see
#### when you browse to https://community.chocolatey.org/api/v2/
package {'chocolatey':
ensure => latest,
provider => chocolatey,
source => $_repository_url,
}
## 5. ENSURE CHOCOLATEY FOR BUSINESS ##
### If you don't have Chocolatey for Business (C4B), you'll want to remove from here down.
### a. Ensure The License File Is Installed ###
#### Create a license package using script from https://docs.chocolatey.org/en-us/guides/organizations/organizational-deployment-guide#exercise-4-create-a-package-for-the-license
# TODO: Add resource for installing/ensuring the chocolatey-license package
package {'chocolatey-license':
ensure => latest,
provider => chocolatey,
source => $_repository_url,
}
### b. Disable The Licensed Source ###
#### The licensed source cannot be removed, so it must be disabled.
#### This must occur after the license has been set by the license package.
## Disabled sources still need all other attributes until
## https://tickets.puppetlabs.com/browse/MODULES-4449 is resolved.
## Password is necessary with user, but not ensurable, so it should not
## matter what it is set to here. If you ever do get into trouble here,
## the password is your license GUID.
chocolateysource {'chocolatey.licensed':
ensure => disabled,
priority => '10',
user => 'customer',
password => '1234',
require => Package['chocolatey-license'],
}
### c. Ensure Chocolatey Licensed Extension ###
#### You will have downloaded the licensed extension to your internal repository
#### as you have disabled the licensed repository in step 5b.
#### Ensure the chocolatey.extension package (aka Chocolatey Licensed Extension)
package {'chocolatey.extension':
ensure => latest,
provider => chocolatey,
source => $_repository_url,
require => Package['chocolatey-license'],
}
#### The Chocolatey Licensed Extension unlocks all of the following, which also have configuration/feature items available with them. You may want to visit the feature pages to see what you might want to also enable:
#### - Package Builder - https://docs.chocolatey.org/en-us/features/paid/package-builder
#### - Package Internalizer - https://docs.chocolatey.org/en-us/features/paid/package-internalizer
#### - Package Synchronization (3 components) - https://docs.chocolatey.org/en-us/features/paid/package-synchronization
#### - Package Reducer - https://docs.chocolatey.org/en-us/features/paid/package-reducer
#### - Package Audit - https://docs.chocolatey.org/en-us/features/paid/package-audit
#### - Package Throttle - https://docs.chocolatey.org/en-us/features/paid/package-throttle
#### - CDN Cache Access - https://docs.chocolatey.org/en-us/features/paid/private-cdn
#### - Branding - https://docs.chocolatey.org/en-us/features/paid/branding
#### - Self-Service Anywhere (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/self-service-anywhere
#### - Chocolatey Central Management (more components will need to be installed and additional configuration will need to be set) - https://docs.chocolatey.org/en-us/features/paid/chocolatey-central-management
#### - Other - https://docs.chocolatey.org/en-us/features/paid/
### d. Ensure Self-Service Anywhere ###
#### If you have desktop clients where users are not administrators, you may
#### to take advantage of deploying and configuring Self-Service anywhere
chocolateyfeature {'showNonElevatedWarnings':
ensure => disabled,
}
chocolateyfeature {'useBackgroundService':
ensure => enabled,
}
chocolateyfeature {'useBackgroundServiceWithNonAdministratorsOnly':
ensure => enabled,
}
chocolateyfeature {'allowBackgroundServiceUninstallsFromUserInstallsOnly':
ensure => enabled,
}
chocolateyconfig {'backgroundServiceAllowedCommands':
value => 'install,upgrade,uninstall',
}
### e. Ensure Chocolatey Central Management ###
#### If you want to manage and report on endpoints, you can set up and configure
### Central Management. There are multiple portions to manage, so you'll see
### a section on agents here along with notes on how to configure the server
### side components.
if $_chocolatey_central_management_url {
package {'chocolatey-agent':
ensure => latest,
provider => chocolatey,
source => $_repository_url,
require => Package['chocolatey-license'],
}
chocolateyconfig {'CentralManagementServiceUrl':
value => $_chocolatey_central_management_url,
}
if $_chocolatey_central_management_client_salt {
chocolateyconfig {'centralManagementClientCommunicationSaltAdditivePassword':
value => $_chocolatey_central_management_client_salt,
}
}
if $_chocolatey_central_management_service_salt {
chocolateyconfig {'centralManagementClientCommunicationSaltAdditivePassword':
value => $_chocolatey_central_management_client_salt,
}
}
chocolateyfeature {'useChocolateyCentralManagement':
ensure => enabled,
require => Package['chocolatey-agent'],
}
chocolateyfeature {'useChocolateyCentralManagementDeployments':
ensure => enabled,
require => Package['chocolatey-agent'],
}
}
Need Help? View our docs or file an issue.
There is already a version of this package in your Script Builder
Current Version | New Version |
---|---|
- Passing
- Failing
- Pending
- Unknown / Exempted

Downloads:
818,692
Downloads of v 2.6.20:
511
Last Update:
17 Dec 2015
Package Maintainer(s):
Software Author(s):
- Matt Wrock
Tags:
- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download

Boxstarter Common Module
This is not the latest version of Boxstarter Common Module available.
- 1
- 2
- 3
2.6.20 | Updated: 17 Dec 2015
- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Downloads:
818,692
Downloads of v 2.6.20:
511
Software Author(s):
- Matt Wrock
Edit Package
To edit the metadata for a package, please upload an updated version of the package.
Chocolatey's Community Package Repository currently does not allow updating package metadata on the website. This helps ensure that the package itself (and the source used to build the package) remains the one true source of package metadata.
This does require that you increment the package version.
- 1
- 2
- 3
Boxstarter Common Module
2.6.20
This is not the latest version of Boxstarter Common Module available.
- 1
- 2
- 3
Some Checks Have Failed or Are Not Yet Complete
Not All Tests Have Passed
Deployment Method: Individual Install, Upgrade, & Uninstall
To install Boxstarter Common Module, run the following command from the command line or from PowerShell:
To upgrade Boxstarter Common Module, run the following command from the command line or from PowerShell:
To uninstall Boxstarter Common Module, run the following command from the command line or from PowerShell:
Deployment Method:
📝 NOTE: This applies to both open source and commercial editions of Chocolatey.
1. Enter Your Internal Repository Url
(this should look similar to https://community.chocolatey.org/api/v2/)
2. Setup Your Environment
1. Ensure you are set for organizational deployment
Please see the organizational deployment guide
2. Get the package into your environment
Option 1: Cached Package (Unreliable, Requires Internet - Same As Community)-
Open Source or Commercial:
- Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
- You can also just download the package and push it to a repository Download
-
Open Source
-
Download the package:
Download - Follow manual internalization instructions
-
-
Package Internalizer (C4B)
-
Run: (additional options)
choco download boxstarter.common --internalize --version=2.6.20 --source=https://community.chocolatey.org/api/v2/
-
For package and dependencies run:
choco push --source="'INTERNAL REPO URL'"
- Automate package internalization
-
Run: (additional options)
3. Copy Your Script
choco upgrade boxstarter.common -y --source="'INTERNAL REPO URL'" --version="'2.6.20'" [other options]
See options you can pass to upgrade.
See best practices for scripting.
Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.
If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:
choco upgrade boxstarter.common -y --source="'INTERNAL REPO URL'" --version="'2.6.20'"
$exitCode = $LASTEXITCODE
Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
Exit 0
}
Exit $exitCode
- name: Install boxstarter.common
win_chocolatey:
name: boxstarter.common
version: '2.6.20'
source: INTERNAL REPO URL
state: present
See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.
chocolatey_package 'boxstarter.common' do
action :install
source 'INTERNAL REPO URL'
version '2.6.20'
end
See docs at https://docs.chef.io/resource_chocolatey_package.html.
cChocoPackageInstaller boxstarter.common
{
Name = "boxstarter.common"
Version = "2.6.20"
Source = "INTERNAL REPO URL"
}
Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.
package { 'boxstarter.common':
ensure => '2.6.20',
provider => 'chocolatey',
source => 'INTERNAL REPO URL',
}
Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.
4. If applicable - Chocolatey configuration/installation
See infrastructure management matrix for Chocolatey configuration elements and examples.
This package was approved as a trusted package on 17 Dec 2015.
Provides common functions used by multiple Boxstarter Modules.
Resolve-Path $PSScriptRoot\*.ps1 |
% { . $_.ProviderPath }
Export-ModuleMember Confirm-Choice,`
Create-BoxstarterTask,`
Enter-BoxstarterLogable,`
Enter-DotNet4,`
Get-CurrentUser,`
Get-HttpResource,`
Get-IsMicrosoftUpdateEnabled,`
Get-IsRemote,`
Invoke-FromTask,`
Invoke-RetriableScript,`
Out-BoxstarterLog,`
Log-BoxstarterMessage,`
Remove-BoxstarterError,`
Remove-BoxstarterTask,`
Start-TimedSection,`
Stop-TimedSection,`
Test-Admin,`
Write-BoxstarterLogo,`
Write-BoxstarterMessage
Export-ModuleMember -Variable Boxstarter
function Confirm-Choice {
<#
.SYNOPSIS
Prompts the user to choose a yes/no option.
.DESCRIPTION
The message parameter is presented to the user and the user is then prompted to
respond yes or no. In environments such as the PowerShell ISE, the Confirm param
is the title of the window presenting the message.
.Parameter Message
The message given to the user that tels them what they are responding yes/no to.
.Parameter Caption
The title of the dialog window that is presented in environments that present
the prompt in its own window. If not provided, the Message is used.
.LINK
http://boxstarter.org
#>
param (
[string]$Message,
[string]$Caption = $Message
)
$yes = new-Object System.Management.Automation.Host.ChoiceDescription "&Yes","Yes";
$no = new-Object System.Management.Automation.Host.ChoiceDescription "&No","No";
$choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no);
$answer = $host.ui.PromptForChoice($caption,$message,$choices,0)
switch ($answer){
0 {return $true; break}
1 {return $false; break}
}
}
function Create-BoxstarterTask{
<#
.SYNOPSIS
Creates a Scheduled Task for Boxstarter operations that require a local
administrative token
.DESCRIPTION
Create-BoxstarterTask creates a scheduled task. This task is present
throughout a boxstarter installation process and is used when Boxstarter
needs to complete a task that cannot use a remote token. This function
does not run the task. It simply creates it.
.Parameter Credential
The credentials under which the task will run.
.LINK
http://boxstarter.org
Invoke-FromTask
Remove-BoxstarterTask
#>
param([Management.Automation.PsCredential]$Credential)
if($Credential.GetNetworkCredential().Password.length -gt 0){
schtasks /CREATE /TN 'Temp Boxstarter Task' /SC WEEKLY /RL HIGHEST `
/RU "$($Credential.UserName)" /IT /RP $Credential.GetNetworkCredential().Password `
/TR "powershell -noprofile -ExecutionPolicy Bypass -File $env:temp\BoxstarterTask.ps1" /F |
Out-Null
#Give task a normal priority
$taskFile = Join-Path $env:TEMP RemotingTask.txt
Remove-Item $taskFile -Force -ErrorAction SilentlyContinue
[xml]$xml = schtasks /QUERY /TN 'Temp Boxstarter Task' /XML
$xml.Task.Settings.Priority="4"
$xml.Save($taskFile)
schtasks /CREATE /TN 'Boxstarter Task' /RU "$($Credential.UserName)" /IT /RP $Credential.GetNetworkCredential().Password /XML "$taskFile" /F | Out-Null
schtasks /DELETE /TN 'Temp Boxstarter Task' /F | Out-Null
}
elseif(!((schtasks /QUERY /TN 'Boxstarter Task' /FO LIST 2>&1) -contains 'Logon Mode: Interactive/Background')) { #For testing
schtasks /CREATE /TN 'Boxstarter Task' /SC WEEKLY /RL HIGHEST `
/RU "$($Credential.UserName)" /IT `
/TR "powershell -noprofile -ExecutionPolicy Bypass -File $env:temp\BoxstarterTask.ps1" /F |
Out-Null
}
if($LastExitCode -gt 0){
throw "Unable to create scheduled task as $($Credential.UserName)"
}
}
TOPIC
About_Boxstarter_Logging
SYNOPSIS
Describes how to the different Boxstarter Logging functions to log to
the console, log file or both.
DESCRIPTION
Boxstarter provides several logging logging functions to make it easy
to deliver messages to script consumers and provide detailed debugging
information to log files. Here is a description of each of these
functions:
Write-BoxstarterMessage
Writes a message to both the Boxstarter log file and to the screen.
These messages are output in Green to make them stand out from
other messages.
Log-BoxstarterMessage
Only writes a message to the Boxstarter log file. The message is
not logged to the console.
Out-BoxtarterLog
This is identical to Write-BoxstarterMessage but the text written
to the screen is not in green. It is formatted normally.
Enter-BoxstarterLogable
This executes a script block and redirects the standard output
stream and standard error stream to both the console and the
Boxstarter log file. This is similar to Out-Boxstarterlog but it
includes the output from standard command line utilities.
Start-TimedSection and Stop-TimedSection
These functions surround all script in between the start and end
functions with a header and footer message and time the script
execution. The footer message includes the total elapsed time.
These sections can be nested.
SEE ALSO
http://boxstarter.org
Write-BoxstarterMessage
Out-BoxtarterLog
Enter-BoxstarterLogable
Start-TimedSection
Stop-TimedSection
function Enter-Dotnet4 {
<#
.SYNOPSIS
Runs a script from a process hosting the .net 4 runtile
.DESCRIPTION
This function will ensure that the .net 4 runtime is installed on the
machine. If it is not, it will be downloaded and installed. If running
remotely, the .net 4 installation will run from a scheduled task.
If the CLRVersion of the hosting powershell process is less than 4,
such as is the case in powershell 2, the given script will be run
from a new a new powershell process tht will be configured to host the
CLRVersion 4.0.30319.
.Parameter ScriptBlock
The script to be executed in the .net 4 CLR
.Parameter ArgumentList
Arguments to be passed to the ScriptBlock
.LINK
http://boxstarter.org
#>
param(
[ScriptBlock]$ScriptBlock,
[object[]]$ArgumentList
)
Enable-Net40
if($PSVersionTable.CLRVersion.Major -lt 4) {
Write-BoxstarterMessage "Relaunching powershell under .net fx v4" -verbose
$env:COMPLUS_version="v4.0.30319"
& powershell -OutputFormat Text -ExecutionPolicy bypass -command $ScriptBlock -args $ArgumentList
}
else {
Write-BoxstarterMessage "Using current powershell..." -verbose
Invoke-Command -ScriptBlock $ScriptBlock -argumentlist $ArgumentList
}
}
function Is64Bit { [IntPtr]::Size -eq 8 }
function Enable-Net40 {
if(Is64Bit) {$fx="framework64"} else {$fx="framework"}
if(!(test-path "$env:windir\Microsoft.Net\$fx\v4.0.30319")) {
if((Test-PendingReboot) -and $Boxstarter.RebootOk) {return Invoke-Reboot}
Write-BoxstarterMessage "Downloading .net 4.5..."
Get-HttpResource "http://download.microsoft.com/download/b/a/4/ba4a7e71-2906-4b2d-a0e1-80cf16844f5f/dotnetfx45_full_x86_x64.exe" "$env:temp\net45.exe"
Write-BoxstarterMessage "Installing .net 4.5..."
if(Get-IsRemote) {
Invoke-FromTask @"
Start-Process "$env:temp\net45.exe" -verb runas -wait -argumentList "/quiet /norestart /log $env:temp\net45.log"
"@
}
else {
$proc = Start-Process "$env:temp\net45.exe" -verb runas -argumentList "/quiet /norestart /log $env:temp\net45.log" -PassThru
while(!$proc.HasExited){ sleep -Seconds 1 }
}
}
}
function Format-BoxStarterMessage {
param($BoxStarterMessage)
if(Get-IsRemote){
$BoxStarterMessage = "[$env:Computername]$BoxStarterMessage"
}
return $BoxStarterMessage
}
function Get-CurrentUser {
<#
.SYNOPSIS
Returns the domain and username of the currently logged in user.
#>
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$parts = $identity.Name -split "\\"
return @{Domain=$parts[0];Name=$parts[1]}
}
function Get-HttpResource {
<#
.SYNOPSIS
Downloads the contents from a URL
.DESCRIPTION
Get-HttpResource downloads the contents of an HTTP url.
When -PassThru is specified it returns the string content.
.PARAMETER Url
The url containing the content to download.
.PARAMETER OutputPath
If provided, the content will be saved to this path.
.PARAMETER PassThru
If provided, the string will be output to the pipeline.
.EXAMPLE
$content = Get-HttpResource -Url 'http://my/url' `
-OutputPath 'c:\myfile.txt' `
-PassThru
This downloads the content located at http://my/url and
saves it to a file at c:\myfile.txt and also returns
the downloaded string.
.LINK
http://boxstarter.org
#>
param (
[string]$Url,
[string]$OutputPath = $null,
[switch]$PassThru
)
Write-BoxstarterMessage "Downloading $url" -Verbose
$str = Invoke-RetriableScript -RetryScript {
$downloader=new-object net.webclient
$wp=[system.net.WebProxy]::GetDefaultProxy()
$wp.UseDefaultCredentials=$true
$downloader.Proxy=$wp
try {
$httpString = $downloader.DownloadString($args[0])
if($args[1]) {
Write-BoxstarterMessage "Saving $httpString to $($args[1])" -Verbose
if(Test-Path $args[1]){Remove-Item $args[1] -Force}
$httpString | Out-File -FilePath $args[1] -Encoding utf8
}
$httpString
}
catch{
if($VerbosePreference -eq "Continue"){
Write-Error $($_.Exception | fl * -Force | Out-String)
}
throw $_
}
} $Url $OutputPath
if($PassThru) { Write-Output $str }
}
function Get-IsMicrosoftUpdateEnabled {
<#
.SYNOPSIS
Returns $True if Microsoft Update is currently enabled
.LINK
http://boxstarter.org
#>
# Default response to false, unless proven otherwise
$installed = $false
$serviceManager = New-Object -ComObject Microsoft.Update.ServiceManager -Strict
$serviceManager.ClientApplicationID = "Boxstarter"
foreach ($service in $serviceManager.Services) {
if( $service.Name -eq "Microsoft Update") {
$installed = $true;
break;
}
}
return $installed
}
function Get-IsRemote {
param (
[switch]$PowershellRemoting
)
<#
.SYNOPSIS
Returns $True if the current PowerShell session is running remotely
.LINK
http://boxstarter.org
#>
if($PSSenderInfo -ne $null) {return $true}
if($PowershellRemoting) {return $false}
if($env:IsRemote -ne $null) { return [bool]::Parse($env:IsRemote) }
else {
$script:recursionLevel = 0
$env:IsRemote = Test-ChildOfWinrs
return [bool]::Parse($env:IsRemote)
}
}
function Test-ChildOfWinrs($ID = $PID) {
if(++$script:recursionLevel -gt 20) { return $false }
$parent = (Get-WmiObject -Class Win32_Process -Filter "ProcessID=$ID").ParentProcessID
if($parent -eq $null) {
Log-BoxstarterMessage "No parent process found. Must be root."
return $false
}
else {
try {$parentProc = Get-Process -ID $parent -ErrorAction Stop} catch {
Log-BoxstarterMessage "Error getting parent process"
$global:error.RemoveAt(0)
return $false
}
Log-BoxstarterMessage "parent process is $($parentProc.Name)"
if(@('wsmprovhost','winrshost') -Contains $parentProc.Name) {return $true}
elseif($parentProc.Name -eq "services") {return $false}
else {
return Test-ChildOfWinrs $parent
}
}
}
if(!$Global:Boxstarter) {
$Global:Boxstarter = @{}
$Boxstarter.SuppressLogging=$false
}
$Boxstarter.BaseDir=(Split-Path -parent ((Get-Item $PSScriptRoot).FullName))
function Invoke-FromTask {
<#
.SYNOPSIS
Invokes a command inside of a scheduled task
.DESCRIPTION
This invokes the boxstarter scheduled task.
The task is run in an elevated session using the provided
credentials. If the processes started by the task become idle for
more that the specified timeout, the task will be terminated. All
output and any errors from the task will be streamed to the calling
session.
.PARAMETER Command
The command to run in the task.
.PARAMETER IdleTimeout
The number of seconds after which the task will be terminated if it
becomes idle. The value 0 is an indefinite timeout and 120 is the
default.
.PARAMETER TotalTimeout
The number of seconds after which the task will be terminated whether
it is idle or active.
.EXAMPLE
Invoke-FromTask Install-WindowsUpdate -AcceptEula
This will install Windows Updates in a scheduled task
.EXAMPLE
Invoke-FromTask "DISM /Online /NoRestart /Enable-Feature:TelnetClient" -IdleTimeout 20
This will use DISM.exe to install the telnet client and will kill
the task if it becomes idle for more that 20 seconds.
.LINK
http://boxstarter.org
Create-BoxstarterTask
Remove-BoxstarterTask
#>
param(
$command,
$DotNetVersion = $null,
$idleTimeout=120,
$totalTimeout=3600
)
Write-BoxstarterMessage "Invoking $command in scheduled task" -Verbose
$runningCommand = Add-TaskFiles $command $DotNetVersion
$taskProc = start-Task $runningCommand
if($taskProc -ne $null){
Write-BoxstarterMessage "Command launched in process $taskProc" -Verbose
try {
$waitProc=get-process -id $taskProc -ErrorAction Stop
Write-BoxstarterMessage "Waiting on $($waitProc.Id)" -Verbose
} catch { $global:error.RemoveAt(0) }
}
try {
Wait-ForTask $waitProc $idleTimeout $totalTimeout
}
catch {
Write-BoxstarterMessage "error thrown managing task" -verbose
Write-BoxstarterMessage "$($_ | fl * -force | out-string)" -verbose
throw $_
}
Write-BoxstarterMessage "Task has completed" -Verbose
$verboseStream = Get-CliXmlStream (Get-ErrorFileName) 'verbose'
if($verboseStream -ne $null) {
Write-BoxstarterMessage "Warnings and Verbose output from task:"
$verboseStream | % { Write-Host $_ }
}
$errorStream = Get-CliXmlStream (Get-ErrorFileName) 'error'
if($errorStream -ne $null -and $errorStream.length -gt 0) {
throw $errorStream
}
}
function Get-ErrorFileName { "$env:temp\BoxstarterError.stream" }
function Get-CliXmlStream($cliXmlFile, $stream) {
$content = get-content $cliXmlFile
if($content.count -lt 2) { return $null }
# Strip the first line containing '#< CLIXML'
[xml]$xml = $content[1..($content.count-1)]
# return stream stripping carriage retuens and linefeeds
$xml.DocumentElement.ChildNodes |
? { $_.S -eq $stream } |
% { $_.'#text'.Replace('_x000D_','').Replace('_x000A_','') } |
out-string
}
function Get-ChildProcessMemoryUsage {
param(
$ID=$PID,
[int]$res=0
)
Get-WmiObject -Class Win32_Process -Filter "ParentProcessID=$ID" | % {
if($_.ProcessID -ne $null) {
try {
$proc = Get-Process -ID $_.ProcessID -ErrorAction Stop
Write-BoxstarterMessage "$($_.Name) $($proc.PrivateMemorySize + $proc.WorkingSet)" -Verbose
$res += $proc.PrivateMemorySize + $proc.WorkingSet
$res += (Get-ChildProcessMemoryUsage $_.ProcessID $res)
} catch { $global:error.RemoveAt(0) }
}
}
$res
}
function Add-TaskFiles($command, $DotNetVersion) {
$encoded = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes("`$ProgressPreference='SilentlyContinue';$command"))
[email protected]"
$(if($DotNetVersion -ne $null){"`$env:COMPLUS_version='$DotNetVersion'"})
Start-Process powershell -NoNewWindow -Wait -RedirectStandardError $(Get-ErrorFileName) -RedirectStandardOutput $env:temp\BoxstarterOutput.stream -WorkingDirectory '$PWD' -ArgumentList "-noprofile -ExecutionPolicy Bypass -EncodedCommand $encoded"
Remove-Item $env:temp\BoxstarterTask.ps1 -ErrorAction SilentlyContinue
"@
Set-Content $env:temp\BoxstarterTask.ps1 -value $fileContent -force
new-Item $env:temp\BoxstarterOutput.stream -Type File -Force | out-null
new-Item (Get-ErrorFileName) -Type File -Force | out-null
$encoded
}
function start-Task($encoded){
[email protected]()
$tasks+=gwmi Win32_Process -Filter "name = 'powershell.exe' and CommandLine like '%$encoded%'" | select ProcessId | % { $_.ProcessId }
Write-BoxstarterMessage "Found $($tasks.Length) tasks already running" -Verbose
$taskResult = schtasks /RUN /I /TN 'Boxstarter Task'
if($LastExitCode -gt 0){
throw "Unable to run scheduled task. Message from task was $taskResult"
}
Write-BoxstarterMessage "Launched task. Waiting for task to launch command..." -Verbose
do{
if(!(Test-Path $env:temp\BoxstarterTask.ps1)){
Write-BoxstarterMessage "Task Completed before its process was captured." -Verbose
break
}
$taskProc=gwmi Win32_Process -Filter "name = 'powershell.exe' and CommandLine like '%$encoded%'" | select ProcessId | % { $_.ProcessId } | ? { !($tasks -contains $_) }
Start-Sleep -Second 1
}
Until($taskProc -ne $null)
return $taskProc
}
function Test-TaskTimeout($waitProc, $idleTimeout) {
if($memUsageStack -eq $null){
$script:memUsageStack=New-Object -TypeName System.Collections.Stack
}
if($idleTimeout -gt 0){
$lastMemUsageCount=Get-ChildProcessMemoryUsage $waitProc.ID
Write-BoxstarterMessage "Memory read: $lastMemUsageCount" -Verbose
Write-BoxstarterMessage "Memory count: $($memUsageStack.Count)" -Verbose
$memUsageStack.Push($lastMemUsageCount)
if($lastMemUsageCount -eq 0 -or (($memUsageStack.ToArray() | ? { $_ -ne $lastMemUsageCount }) -ne $null)){
$memUsageStack.Clear()
}
if($memUsageStack.Count -gt $idleTimeout){
Write-BoxstarterMessage "Task has exceeded its timeout with no activity. Killing task..."
KillTree $waitProc.ID
throw "TASK:`r`n$command`r`n`r`nIs likely in a hung state."
}
}
Start-Sleep -Second 1
}
function Wait-ForTask($waitProc, $idleTimeout, $totalTimeout){
$reader=New-Object -TypeName System.IO.FileStream -ArgumentList @(
"$env:temp\BoxstarterOutput.Stream",
[system.io.filemode]::Open,[System.io.FileAccess]::ReadWrite,
[System.IO.FileShare]::ReadWrite)
try{
$procStartTime = $waitProc.StartTime
while($waitProc -ne $null -and !($waitProc.HasExited)) {
$timeTaken = [DateTime]::Now.Subtract($procStartTime)
if($totalTimeout -gt 0 -and $timeTaken.TotalSeconds -gt $totalTimeout){
Write-BoxstarterMessage "Task has exceeded its total timeout. Killing task..."
KillTree $waitProc.ID
throw "TASK:`r`n$command`r`n`r`nIs likely in a hung state."
}
$byte = New-Object Byte[] 100
$count=$reader.Read($byte,0,100)
if($count -ne 0){
$text = [System.Text.Encoding]::Default.GetString($byte,0,$count)
$text | Write-Host -NoNewline
}
else {
Test-TaskTimeout $waitProc $idleTimeout
}
}
Start-Sleep -Second 1
Write-BoxstarterMessage "Proc has exited: $($waitProc.HasExited) or Is Null: $($waitProc -eq $null)" -Verbose
$byte=$reader.ReadByte()
$text=$null
while($byte -ne -1){
$text += [System.Text.Encoding]::Default.GetString($byte)
$byte=$reader.ReadByte()
}
if($text -ne $null){
$text | write-host -NoNewline
}
}
finally{
$reader.Dispose()
if($waitProc -ne $null -and !$waitProc.HasExited){
KillTree $waitProc.ID
}
}
}
function KillTree($id){
Get-WmiObject -Class Win32_Process -Filter "ParentProcessID=$ID" | % {
if($_.ProcessID -ne $null) {
Invoke-SilentKill $_.ProcessID
Write-BoxstarterMessage "Killing $($_.Name)" -Verbose
KillTree $_.ProcessID
}
}
Invoke-SilentKill $id -wait
}
function Invoke-SilentKill($id, [switch]$wait) {
try {
$p = Kill $id -ErrorAction Stop -Force
if($wait) {
while($p -ne $null -and !$p.HasExited){
Start-Sleep 1
}
}
}
catch {
$global:error.RemoveAt(0)
}
}
function Invoke-RetriableScript{
<#
.SYNOPSIS
Retries a script 5 times or until it completes without terminating errors.
All Unnamed arguments will be passed as arguments to the script
#>
param([ScriptBlock]$RetryScript)
$currentErrorAction=$ErrorActionPreference
try{
$ErrorActionPreference = "Stop"
for($count = 1; $count -le 5; $count++) {
try {
Write-BoxstarterMessage "Attempt #$count..." -Verbose
$ret = Invoke-Command -ScriptBlock $RetryScript -ArgumentList $args
return $ret
break
}
catch {
if($global:Error.Count -gt 0){$global:Error.RemoveAt(0)}
if($count -eq 5) { throw $_ }
else { Sleep 10 }
}
}
}
finally{
$ErrorActionPreference = $currentErrorAction
}
}
function Log-BoxStarterMessage {
<#
.SYNOPSIS
Logs a message to the Boxstarter Log File
.DESCRIPTION
Logs a message to the log. The message does not render on the
console. Boxstarter timestamps the log message so that the file
entry has the time the message was written. The log is located at
$Boxstarter.Log.
.Parameter Message
The message to be logged.
.LINK
http://boxstarter.org
about_boxstarter_logging
#>
param([object[]]$message)
if($Boxstarter.Log) {
$fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @(
$Boxstarter.Log,
[system.io.filemode]::Append,
[System.io.FileAccess]::Write,
[System.IO.FileShare]::ReadWrite
)
$writer = New-Object -TypeName System.IO.StreamWriter -ArgumentList @(
$fileStream,
[System.Text.Encoding]::UTF8
)
try {
$writer.WriteLine("[$(Get-Date -format o):::PID $pid] $message")
}
finally{
$writer.Dispose()
}
}
}
function Enter-BoxstarterLogable{
<#
.SYNOPSIS
Logs the output and error streams of the script to the
console and Boxstarter log.
.DESCRIPTION
Boxstarter runs the provided script and redirects the
standard output and standard error streams to the host
console and to the Boxstarter log. This will include both
PowerShell write-output and errors as well as the output
from any standard command line executables that use
standard output and error streams.
.PARAMETER script
The script to execute.
.EXAMPLE
Enter-BoxstarterLogable{
Get-Process Chrome
Netstat
}
This sends both the out put of the PowerShell Get-Process
cmdlet and the Netstat command line utility to the screen
as well as th boxstarter log.
.LINK
http://boxstarter.org
about_boxstarter_logging
#>
param([ScriptBlock] $script)
& ($script) 2>&1 | Out-BoxstarterLog
}
function Out-BoxstarterLog {
<#
.SYNOPSIS
Logs provided text or objects to the console and
Boxstarter log.
.DESCRIPTION
This is essentially identical to Tee-Object with the PS 3.0
only parameter -Append. This will work in either PS 2.0 or
PS 3.0.
.PARAMETER object
Object to log.
.EXAMPLE
Out-BoxstarterLog "This can be seen on the screen and in the log file"
.EXAMPLE
"This can be seen on the screen and in the log file" | Out-BoxstarterLog
.LINK
http://boxstarter.org
about_boxstarter_logging
#>
param(
[Parameter(position=0,ValueFromPipeline=$True)]
[object]$object,
[switch]$Quiet
)
process {
if(!$Quiet -and !$Boxstarter.SuppressLogging){write-host $object}
if($object){
Log-BoxstarterMessage $object
}
}
}
function Remove-BoxstarterError {
<#
.SYNOPSIS
Removes errors from the error collection that occur within a block.
#>
param([ScriptBlock]$block)
$currentErrorAction=$Global:ErrorActionPreference
$currentErrorCount = $Global:Error.Count
try{
$Global:ErrorActionPreference = "SilentlyContinue"
Invoke-Command -ScriptBlock $block
while($Global:Error.Count -gt $currentErrorCount){
$Global:Error.RemoveAt(0)
}
}
finally{
$Global:ErrorActionPreference = $currentErrorAction
}
}
function Remove-BoxstarterTask {
<#
.SYNOPSIS
Deletes the Boxstarter task.
.DESCRIPTION
Deletes the Boxstarter task. Boxstarter calls this when an
installation session completes.
.LINK
http://boxstarter.org
Create-BoxstarterTask
Invoke-BoxstarterTask
#>
Write-BoxstarterMessage "Removing Boxstarter Scheduled Task..." -Verbose
Remove-BoxstarterError {
$result = schtasks /DELETE /TN 'Boxstarter Task' /F 2>&1
Write-BoxstarterMessage "Removed Boxstarter Scheduled Task with this result: $result" -Verbose
}
}
function Start-TimedSection {
<#
.SYNOPSIS
Begins a timed section
.DESCRIPTION
A timed section is a portion of script that is timed. Used
with Stop-TimedSection, the beginning and end of the section
are logged to both the console and the log along with the
amount of time elapsed.
The function returns a guid that is used to identify the
section when stopping it.
.PARAMETER SectionName
The Title or Label of the section being timed. This string
is used in the logging to identify the section.
.PARAMETER Verbose
Instructs Start-TimedSection to write to the Verbose stream. Although
this will always log messages to the Boxstarter log, it will only log
to the console if the session's VerbosePreference is set to capture
the Verbose stream or the -Verbose switch was set when calling
Install-BoxstarterPackage.
.EXAMPLE
$session=Start-TimedSection "My First Section"
Stop-TimedSection $session
This creates a block as follows:
+ Boxstarter starting My First Section
Some stuff happens here.
+ Boxstarter finished My First Section 00:00:00.2074282
.EXAMPLE
Timed Sections can be nested or staggered. You can have
multiple sections running at once.
$session=Start-TimedSection "My First Section"
$innerSession=Start-TimedSection "My Inner Section"
Stop-TimedSection $innerSession
Stop-TimedSection $session
This creates a block as follows:
+ Boxstarter starting My First Section
Some stuff happens here.
++ Boxstarter starting My Inner Section
Some inner stuff happens here.
++ Boxstarter finished My Inner Section 00:00:00.1074282
Some more stuff happens here.
+ Boxstarter finished My First Section 00:00:00.2074282
Note that the number of '+' chars indicate nesting level.
.EXAMPLE
$session=Start-TimedSection "My First Section" -Verbose
Stop-TimedSection $session
This will write the start and finish messages to the
Boxstarter log but will not write to the console unless the
user has the the VerbosePreference variable or used the
Verbose switch of Install-BoxstarterPackage.
.NOTES
If the SuppressLogging setting of the $Boxstarter variable is true,
logging messages will be suppressed and not sent to the console or the
log.
.LINK
http://boxstarter.org
Stop-TimedSection
about_boxstarter_logging
#>
param(
[string]$sectionName,
[switch]$Verbose)
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
$guid = [guid]::NewGuid().ToString()
[email protected]{title=$sectionName;stopwatch=$stopwatch;verbose=$Verbose}
if(!$script:boxstarterTimers) {$script:[email protected]{}}
$boxstarterTimers.$guid=$timerEntry
$padCars="".PadLeft($boxstarterTimers.Count,"+")
Write-BoxstarterMessage "$padCars Boxstarter starting $sectionName" -NoLogo -Verbose:$Verbose
return $guid
}
function Stop-TimedSection {
<#
.SYNOPSIS
Ends a timed section
.DESCRIPTION
A timed section is a portion of script that is timed. Used
with Start-TimedSection, the beginning and end of the section
are logged to both the console and the log along with the
amount of time elapsed.
.PARAMETER SectionId
The guid that was generated by Start-TimedSection and
identifies which section is ending.
.EXAMPLE
$session=Start-TimedSection "My First Section"
Stop-TimedSection $session
This creates a block as follows:
+ Boxstarter starting My First Section
Some stuff happens here.
+ Boxstarter finished My First Section 00:00:00.2074282
.EXAMPLE
Timed Sections can be nested or staggered. You can have
multiple sections running at once.
$session=Start-TimedSection "My First Section"
$innerSession=Start-TimedSection "My Inner Section"
Stop-TimedSection $innerSession
Stop-TimedSection $session
This creates a block as follows:
+ Boxstarter starting My First Section
Some stuff happens here.
++ Boxstarter starting My Inner Section
Some inner stuff happens here.
++ Boxstarter finished My Inner Section 00:00:00.1074282
Some more stuff happens here.
+ Boxstarter finished My First Section 00:00:00.2074282
Note that the number of '+' chars indicate nesting level.
.LINK
http://boxstarter.org
Start-TimedSection
about_boxstarter_logging
#>
param([string]$SectionId)
$timerEntry=$script:boxstarterTimers.$SectionId
if(!$timerEntry){return}
$padCars="".PadLeft($boxstarterTimers.Count,"+")
$script:boxstarterTimers.Remove($SectionId)
$stopwatch = $timerEntry.stopwatch
Write-BoxstarterMessage "$padCars Boxstarter finished $($timerEntry.Title) $($stopwatch.Elapsed.ToString())" -NoLogo -Verbose:$timerEntry.Verbose
$stopwatch.Stop()
}
function Test-Admin {
<#
.SYNOPSIS
Determines if the console is elevated
#>
$identity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object System.Security.Principal.WindowsPrincipal( $identity )
return $principal.IsInRole( [System.Security.Principal.WindowsBuiltInRole]::Administrator )
}
function Write-BoxstarterLogo {
$boxMod=(IEX (Get-Content (join-path $Boxstarter.Basedir Boxstarter.Common\Boxstarter.Common.psd1) | Out-String))
write-BoxstarterMessage "Boxstarter Version $($boxMod.ModuleVersion)" -nologo -Color White
write-BoxstarterMessage "$($boxMod.Copyright) http://boxstarter.org`r`n" -nologo -Color White
}
function Write-BoxstarterMessage {
<#
.SYNOPSIS
Writes a message to the console and the log
.DESCRIPTION
Formats the message in green. This message is also logged to the
Boxstarter log file with a timestamp.
.PARAMETER Message
The string to be logged
.PARAMETER NoLogo
If omitted, the message will be preceded with "Boxstarter: "
.PARAMETER Color
Specifies a foreground color to use for the message. Green is the
default.
.PARAMETER Verbose
Instructs Write-Boxstarter to write to the Verbose stream. Although
this will always log messages to the Boxstarter log, it will only log
to the console if the session's VerbosePreference is set to capture
the Verbose stream or the -Verbose switch was set when calling
Install-BoxstarterPackage.
.EXAMPLE
Write-BoxstarterMessage "I am logging a message."
This creates the following console output:
Boxstarter: I am Logging a Message
This will appear in the log:
[2013-02-11T00:59:44.9768457-08:00] Boxstarter: I am Logging a Message
.EXAMPLE
Write-BoxstarterMessage "I am logging a message." -Verbose
This outputs to the console via the Verbose stream if the session's
VerbosePreference is set to capture the Verbose stream or the
-Verbose switch was set when calling Install-BoxstarterPackage.
This will appear in the log:
[2013-02-11T00:59:44.9768457-08:00] Boxstarter: I am Logging a Message
.NOTES
If the SuppressLogging setting of the $Boxstarter variable is true,
logging messages will be suppressed and not sent to the console or the
log.
.LINK
http://boxstarter.org
about_boxstarter_logging
#>
param(
[String]$message,
[switch]$nologo,
[ConsoleColor]$color=[ConsoleColor]::green,
[switch]$Verbose
)
if($global:Boxstarter.ProgressArgs -and !$Verbose) {
$a=$global:Boxstarter.ProgressArgs
Write-Progress @a -CurrentOperation $message
}
if(!$nologo){$message = "Boxstarter: $message"}
$fmtTitle = Format-BoxStarterMessage $message
Log-BoxstarterMessage $fmtTitle
if($Verbose){
Write-Verbose $fmtTitle
}
else {
#Boxstarter has a Write-host proxy function and it ensures all is logged
if(!$Boxstarter.SuppressLogging){Write-Host $fmtTitle -ForeGroundColor $color}
}
}
$tools = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
. (Join-Path $tools Setup.ps1)
try {
$ModuleName = (Get-ChildItem $tools | ?{ $_.PSIsContainer }).BaseName
Install-Boxstarter "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" $ModuleName $env:chocolateyPackageParameters
} catch {
write-output $_ | fl * -force
throw $_.Exception
}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
function Install-Boxstarter($here, $ModuleName, $installArgs = "") {
$boxstarterPath=Join-Path $env:AppData Boxstarter
if(!(test-Path $boxstarterPath)){
mkdir $boxstarterPath
}
$packagePath=Join-Path $boxstarterPath BuildPackages
if(!(test-Path $packagePath)){
mkdir $packagePath
}
foreach($ModulePath in (Get-ChildItem $here | ?{ $_.PSIsContainer })){
$target=Join-Path $boxstarterPath $modulePath.BaseName
if(test-Path $target){
Remove-Item $target -Recurse -Force
}
}
Copy-Item "$here\*" $boxstarterPath -Recurse -Force -Exclude ChocolateyInstall.ps1, Setup.*
PersistBoxStarterPathToEnvironmentVariable "PSModulePath"
PersistBoxStarterPathToEnvironmentVariable "Path"
$binPath = "$here\..\..\..\bin"
$boxModule=Get-Module Boxstarter.Chocolatey
if($boxModule) {
if($boxModule.Path -like "$env:LOCALAPPDATA\Apps\*") {
$clickonce=$true
}
}
if(!$clickonce){
Import-Module "$boxstarterPath\$ModuleName" -DisableNameChecking -Force -ErrorAction SilentlyContinue
}
$successMsg = @"
The $ModuleName Module has been copied to $boxstarterPath and added to your Module path.
You will need to open a new console for the path to be visible.
Use 'Get-Module Boxstarter.* -ListAvailable' to list all Boxstarter Modules.
To list all available Boxstarter Commands, use:
PS:>Import-Module $ModuleName
PS:>Get-Command -Module Boxstarter.*
To find more info visit http://Boxstarter.org or use:
PS:>Import-Module $ModuleName
PS:>Get-Help Boxstarter
"@
Write-Host $successMsg
if($ModuleName -eq "Boxstarter.Chocolatey" -and !$env:appdata.StartsWith($env:windir)) {
$desktop = $([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory))
$startMenu=$("$env:appdata\Microsoft\Windows\Start Menu\Programs\Boxstarter")
if(!(Test-Path $startMenu)){
mkdir $startMenu
}
$target="powershell.exe"
$targetArgs="-ExecutionPolicy bypass -NoExit -Command `"&'$boxstarterPath\BoxstarterShell.ps1'`""
if($installArgs -inotcontains "nodesktopicon") {
$link = Join-Path $desktop "Boxstarter Shell.lnk"
Create-Shortcut $link $target $targetArgs $boxstarterPath
}
$link = Join-Path $startMenu "Boxstarter Shell.lnk"
Create-Shortcut $link $target $targetArgs $boxstarterPath
Set-Content -Path "$binPath\BoxstarterShell.bat" -Force -Value "$target $TargetArgs"
}
}
function Create-Shortcut($location, $target, $targetArgs, $boxstarterPath) {
$wshshell = New-Object -ComObject WScript.Shell
$lnk = $wshshell.CreateShortcut($location)
$lnk.TargetPath = $target
$lnk.Arguments = "$targetArgs"
$lnk.WorkingDirectory = $boxstarterPath
$lnk.IconLocation="$boxstarterPath\BoxLogo.ico"
$lnk.Save()
$tempFile = "$env:temp\TempShortcut.lnk"
$writer = new-object System.IO.FileStream $tempFile, ([System.IO.FileMode]::Create)
$reader = new-object System.IO.FileStream $location, ([System.IO.FileMode]::Open)
while ($reader.Position -lt $reader.Length)
{
$byte = $reader.ReadByte()
if ($reader.Position -eq 22) {
$byte = 34
}
$writer.WriteByte($byte)
}
$reader.Close()
$writer.Close()
Move-Item -Path $tempFile $location -Force
}
function PersistBoxStarterPathToEnvironmentVariable($variableName){
$value = [Environment]::GetEnvironmentVariable($variableName, 'User')
if($value){
$values=($value -split ';' | ?{ !($_.ToLower() -match "\\boxstarter$")}) -join ';'
$values+=";$boxstarterPath"
}
elseif($variableName -eq "PSModulePath") {
$values=[environment]::getfolderpath("mydocuments")
$values +="\WindowsPowerShell\Modules;$boxstarterPath"
}
else {
$values ="$boxstarterPath"
}
if(!$value -or !($values -contains $boxstarterPath)){
$values = $values.Replace(';;',';')
[Environment]::SetEnvironmentVariable($variableName, $values, 'User')
$varValue = Get-Content env:\$variableName
$varValue += ";$boxstarterPath"
$varValue = $varValue.Replace(';;',';')
Set-Content env:\$variableName -value $varValue
}
}
Log in or click on link to see number of positives.
In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).
Chocolatey Pro provides runtime protection from possible malware.
Add to Builder | Version | Downloads | Last Updated | Status |
---|---|---|---|---|
Boxstarter Common Module 3.0.0-beta-20220427-21 | 67 | Wednesday, April 27, 2022 | Approved | |
Boxstarter Common Module 2.13.0 | 152185 | Thursday, October 15, 2020 | Approved | |
Boxstarter Common Module 2.12.0 | 396447 | Tuesday, October 30, 2018 | Approved | |
Boxstarter Common Module 2.11.0 | 66643 | Wednesday, May 16, 2018 | Approved | |
Boxstarter Common Module 2.10.3 | 55060 | Thursday, July 27, 2017 | Approved | |
Boxstarter Common Module 2.9.27 | 2670 | Wednesday, June 21, 2017 | Approved | |
Boxstarter Common Module 2.9.26 | 5538 | Monday, June 19, 2017 | Approved | |
Boxstarter Common Module 2.9.24 | 739 | Sunday, June 18, 2017 | Approved | |
Boxstarter Common Module 2.9.14 | 6955 | Friday, May 5, 2017 | Approved | |
Boxstarter Common Module 2.8.29 | 31976 | Sunday, May 22, 2016 | Approved | |
Boxstarter Common Module 2.8.27 | 419 | Sunday, May 22, 2016 | Approved | |
Boxstarter Common Module 2.8.21 | 1015 | Thursday, April 28, 2016 | Approved | |
Boxstarter Common Module 2.8.18 | 702 | Tuesday, April 26, 2016 | Approved | |
Boxstarter Common Module 2.8.12 | 1083 | Thursday, April 21, 2016 | Approved | |
Boxstarter Common Module 2.8.0 | 1142 | Friday, April 15, 2016 | Approved | |
Boxstarter Common Module 2.7.0 | 2018 | Sunday, April 3, 2016 | Approved | |
Boxstarter Common Module 2.6.41 | 3830 | Sunday, February 28, 2016 | Approved | |
Boxstarter Common Module 2.6.25 | 6655 | Friday, December 18, 2015 | Approved | |
Boxstarter Common Module 2.6.20 | 511 | Thursday, December 17, 2015 | Approved | |
Boxstarter Common Module 2.6.16 | 691 | Tuesday, December 15, 2015 | Approved | |
Boxstarter Common Module 2.6.2 | 680 | Monday, December 14, 2015 | Approved | |
Boxstarter Common Module 2.6.0 | 426 | Sunday, December 13, 2015 | Approved | |
Boxstarter Common Module 2.5.21 | 9515 | Thursday, August 13, 2015 | Approved | |
Boxstarter Common Module 2.5.19 | 1931 | Sunday, July 26, 2015 | Approved | |
Boxstarter Common Module 2.5.10 | 1758 | Friday, July 10, 2015 | Approved | |
Boxstarter Common Module 2.5.3 | 1325 | Wednesday, July 1, 2015 | Approved | |
Boxstarter Common Module 2.5.1 | 504 | Wednesday, July 1, 2015 | Approved | |
Boxstarter Common Module 2.4.209 | 4593 | Sunday, April 26, 2015 | Approved | |
Boxstarter Common Module 2.4.205 | 2697 | Sunday, April 5, 2015 | Approved | |
Boxstarter Common Module 2.4.196 | 1440 | Friday, March 20, 2015 | Approved | |
Boxstarter Common Module 2.4.188 | 1291 | Monday, March 9, 2015 | Approved | |
Boxstarter Common Module 2.4.183 | 766 | Wednesday, March 4, 2015 | Approved | |
Boxstarter Common Module 2.4.180 | 482 | Tuesday, March 3, 2015 | Approved | |
Boxstarter Common Module 2.4.179 | 419 | Tuesday, March 3, 2015 | Approved | |
Boxstarter Common Module 2.4.159 | 2762 | Sunday, January 18, 2015 | Approved | |
Boxstarter Common Module 2.4.157 | 709 | Thursday, January 15, 2015 | Approved | |
Boxstarter Common Module 2.4.152 | 805 | Monday, January 12, 2015 | Approved | |
Boxstarter Common Module 2.4.149 | 1308 | Friday, December 26, 2014 | Approved | |
Boxstarter Common Module 2.4.146 | 447 | Friday, December 26, 2014 | Approved | |
Boxstarter Common Module 2.4.128 | 1929 | Thursday, November 27, 2014 | Approved | |
Boxstarter Common Module 2.4.123 | 3795 | Wednesday, September 24, 2014 | Approved | |
Boxstarter Common Module 2.4.110 | 806 | Wednesday, September 17, 2014 | Approved | |
Boxstarter Common Module 2.4.93 | 730 | Friday, September 12, 2014 | Approved | |
Boxstarter Common Module 2.4.88 | 1027 | Wednesday, September 3, 2014 | Approved | |
Boxstarter Common Module 2.4.87 | 465 | Wednesday, September 3, 2014 | Approved | |
Boxstarter Common Module 2.4.80 | 2780 | Monday, August 4, 2014 | Approved | |
Boxstarter Common Module 2.4.76 | 520 | Sunday, August 3, 2014 | Approved | |
Boxstarter Common Module 2.4.70 | 668 | Thursday, July 31, 2014 | Approved | |
Boxstarter Common Module 2.4.67 | 702 | Wednesday, July 30, 2014 | Approved | |
Boxstarter Common Module 2.4.61 | 612 | Monday, July 28, 2014 | Approved | |
Boxstarter Common Module 2.4.57 | 434 | Sunday, July 27, 2014 | Approved | |
Boxstarter Common Module 2.4.54 | 636 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Common Module 2.4.53 | 395 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Common Module 2.4.51 | 438 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Common Module 2.4.48 | 499 | Tuesday, July 22, 2014 | Approved | |
Boxstarter Common Module 2.4.46 | 583 | Saturday, July 19, 2014 | Approved | |
Boxstarter Common Module 2.4.41 | 635 | Sunday, July 13, 2014 | Approved | |
Boxstarter Common Module 2.4.39 | 434 | Sunday, July 13, 2014 | Approved | |
Boxstarter Common Module 2.4.38 | 380 | Saturday, July 12, 2014 | Approved | |
Boxstarter Common Module 2.4.35 | 416 | Saturday, July 12, 2014 | Approved | |
Boxstarter Common Module 2.4.32 | 434 | Friday, July 11, 2014 | Approved | |
Boxstarter Common Module 2.4.29 | 1225 | Friday, July 4, 2014 | Approved | |
Boxstarter Common Module 2.4.26 | 991 | Monday, June 23, 2014 | Approved | |
Boxstarter Common Module 2.4.15 | 3084 | Sunday, April 20, 2014 | Approved | |
Boxstarter Common Module 2.4.12 | 440 | Saturday, April 19, 2014 | Approved | |
Boxstarter Common Module 2.4.4 | 822 | Saturday, April 5, 2014 | Approved | |
Boxstarter Common Module 2.4.0 | 450 | Friday, April 4, 2014 | Approved | |
Boxstarter Common Module 2.3.24 | 1908 | Saturday, February 1, 2014 | Approved | |
Boxstarter Common Module 2.3.15 | 554 | Monday, January 27, 2014 | Approved | |
Boxstarter Common Module 2.3.13 | 470 | Saturday, January 25, 2014 | Approved | |
Boxstarter Common Module 2.3.8 | 508 | Thursday, January 23, 2014 | Approved | |
Boxstarter Common Module 2.3.0 | 499 | Monday, January 20, 2014 | Approved | |
Boxstarter Common Module 2.2.78 | 689 | Thursday, January 9, 2014 | Approved | |
Boxstarter Common Module 2.2.59 | 792 | Sunday, December 29, 2013 | Approved | |
Boxstarter Common Module 2.2.23 | 845 | Saturday, December 14, 2013 | Approved | |
Boxstarter Common Module 2.2.16 | 461 | Friday, December 13, 2013 | Approved | |
Boxstarter Common Module 2.2.15 | 482 | Friday, December 13, 2013 | Approved | |
Boxstarter Common Module 2.2.12 | 462 | Friday, December 13, 2013 | Approved | |
BoxStarter Common Module 2.2.0 | 449 | Thursday, December 12, 2013 | Approved | |
BoxStarter Common Module 2.1.0 | 559 | Saturday, November 30, 2013 | Approved | |
BoxStarter Common Module 2.0.25 | 495 | Wednesday, November 20, 2013 | Approved | |
BoxStarter Common Module 2.0.11 | 481 | Monday, November 11, 2013 | Approved | |
BoxStarter Common Module 2.0.4 | 440 | Saturday, November 9, 2013 | Approved | |
BoxStarter Common Module 2.0.1 | 437 | Friday, November 8, 2013 | Approved | |
BoxStarter Common Module 1.1.40 | 596 | Tuesday, October 1, 2013 | Approved | |
BoxStarter Common Module 1.1.35 | 568 | Monday, August 12, 2013 | Approved | |
BoxStarter Common Module 1.1.30 | 446 | Sunday, August 11, 2013 | Approved | |
BoxStarter Common Module 1.1.22 | 467 | Thursday, August 8, 2013 | Approved | |
BoxStarter Common Module 1.1.18 | 443 | Tuesday, August 6, 2013 | Approved | |
BoxStarter Common Module 1.1.12 | 486 | Sunday, August 4, 2013 | Approved | |
BoxStarter Common Module 1.1.0 | 450 | Thursday, August 1, 2013 | Approved | |
BoxStarter Common Module 1.0.33 | 564 | Thursday, April 18, 2013 | Approved | |
BoxStarter Common Module 1.0.20 | 464 | Monday, April 15, 2013 | Approved | |
BoxStarter Common Module 1.0.13 | 492 | Monday, March 25, 2013 | Approved | |
BoxStarter Common Module 1.0.3 | 496 | Wednesday, March 13, 2013 | Approved |
- Use internal function to download http gist scripts.
- No longer vendors a legacy version of Chocolatey. Leverages the current beta Chocolatey library API for all Chocolatey interaction.
This package has no dependencies.
Ground Rules:
- This discussion is only about Boxstarter Common Module and the Boxstarter Common Module package. If you have feedback for Chocolatey, please contact the Google Group.
- This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
- The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
- Tell us what you love about the package or Boxstarter Common Module, or tell us what needs improvement.
- Share your experiences with the package, or extra configuration or gotchas that you've found.
- If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.