From b162255275f2632f968e20b04358f4c46f011a09 Mon Sep 17 00:00:00 2001 From: Chris Long Date: Thu, 20 Jun 2019 14:21:29 -0400 Subject: [PATCH] Use get-command to auto-resolve packer path Resolves https://github.com/clong/DetectionLab/issues/279 --- build.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build.ps1 b/build.ps1 index 392dbbc..e6a4256 100644 --- a/build.ps1 +++ b/build.ps1 @@ -74,7 +74,12 @@ function install_checker { } function check_packer { - #Check for packer at $PackerPath + # Check for packer using Get-Command + if ((Get-Command packer).Path) { + $PackerPath = (Get-Command packer).Path + Write-Output "Packer found at $PackerPath" + } + # Check for packer at $PackerPath if (!(Test-Path $PackerPath)) { Write-Error "Packer not found at $PackerPath" Write-Output 'Re-run the script setting the PackerPath parameter to the location of packer'