From 0320ba90d8e4f5472ad496212fbb0c1ab2a2a4f3 Mon Sep 17 00:00:00 2001 From: dfrancis-adm Date: Fri, 31 May 2019 09:40:16 -0400 Subject: [PATCH] Added check for Chocolatey licensed version --- functions/Invoke-ChocoInternalizePackage.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions/Invoke-ChocoInternalizePackage.ps1 b/functions/Invoke-ChocoInternalizePackage.ps1 index ff2d35d..9b241d4 100644 --- a/functions/Invoke-ChocoInternalizePackage.ps1 +++ b/functions/Invoke-ChocoInternalizePackage.ps1 @@ -24,6 +24,10 @@ function Invoke-ChocoInternalizePackage { [switch]$PurgeWorkingDirectory ) begin { + if (-not (Test-Path -Path $env:ChocolateyInstall\license\chocolatey.license.xml)){ + Throw 'Chocolatey license not found. Internalizing is only supported in licensed versions.' + return + } if ($PurgeWorkingDirectory){ Get-ChildItem -Path $Path -Recurse | Remove-Item -Recurse -Force }