Skip to content

Instantly share code, notes, and snippets.

@tillig
Last active September 28, 2015 17:19
Show Gist options
  • Save tillig/ebe7ca1af84aa5f28c38 to your computer and use it in GitHub Desktop.
Save tillig/ebe7ca1af84aa5f28c38 to your computer and use it in GitHub Desktop.
Boxstarter Package Detection Test
# Detects whether a specific package is already installed
function Test-PackageInstalled
{
param([Parameter(Mandatory=$true)][string] $packageName)
$found = Get-ChildItem -Path "$env:ChocolateyInstall\lib" -Directory -Filter "$packageName.*" | Measure-Object | Select-Object -ExpandProperty Count
return $found -ne 0
}
Test-PackageInstalled nuget.commandline
Test-PackageInstalled notinstalled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment