If chef-client.bat is not found on system, it prints line "No existing installation of chef detected" and resumes as normal.
0.254.130.122
10.254.130.122 )
10.254.130.122 Detected Windows Version 10.0 Build 14393
10.254.130.122 Warning: Unknown version of Windows, assuming default of Windows 2008r2
10.254.130.122
10.254.130.122 C:\Users\vagrant>goto architecture_select
10.254.130.122
10.254.130.122 C:\Users\vagrant>IF "AMD64" == "x86" IF not defined PROCESSOR_ARCHITEW6432
10.254.130.122
10.254.130.122 C:\Users\vagrant>goto chef_installed
10.254.130.122 Checking for existing chef installation
10.254.130.122
10.254.130.122 C:\Users\vagrant>WHERE chef-client2 1>nul 2>nul
10.254.130.122
10.254.130.122 C:\Users\vagrant>If !ERRORLEVEL! == 0 (
10.254.130.122
10.254.130.122 goto key_create
10.254.130.122 ) else (
10.254.130.122
10.254.130.122 goto install
10.254.130.122 )
10.254.130.122 "No existing installation of chef detected"
10.254.130.122 Checking for existing downloaded package at "C:\Users\vagrant\AppData\Local\Temp\chef-client-latest.msi"
10.254.130.122 No existing downloaded packages to delete.
10.254.130.122 Attempting to download client package using PowerShell if available...
10.254.130.122 powershell.exe -ExecutionPolicy Unrestricted -InputFormat None -NoProfile -NonInteractive -File C:\chef\wget.ps1 "https://www.chef.io/chef/download?p=windows&pv=2008r2&m=x86_64&DownloadContext=PowerShell&v=12" "C:\Users\vagrant\AppData\Local\Temp\chef-client-latest.msi"
The core logic uses WHERE.exe which should be compatible even with extremely old shells. I've tested on windows 2012r2 and 2016. It should work all the way back to windows 2003
Resolves issue #439
If chef-client.bat is found on system, it prints line
"Chef is already installed, skipping download"
and skips the download.If chef-client.bat is not found on system, it prints line
"No existing installation of chef detected"
and resumes as normal.The core logic uses WHERE.exe which should be compatible even with extremely old shells. I've tested on windows 2012r2 and 2016. It should work all the way back to windows 2003