chocolatey/boxstarter

Package parameters requires to be enclosed in quotes

schittli opened this issue · 5 comments

This is the same Issue in chocolatey choco: chocolatey/choco#2792

Hello,
I use Chocolatey and Boxstarter and this bug could affect both components, therefore I create the issue in both places and then add a link to the other issue.

For you developers, this long description has good news:
I try very hard to make sure that the description is good and so I am sure that you can find the bug very quickly and probably also solve it in a few minutes. 😃 For you, it's maybe enough to just Read the Chapter "What causes the error ..."

What You Are Seeing?

This problem is very important because it can affect all users/customers and it may very well take many hours to find the problem because: The cause is not at all where you suspect it to be. That's one of the extremely tedious problems in Chocolatey and BoxStarter: it is almost impossible to find out where an exception was generated because the context is missing in the log. For example, the exception I was struggling with in the context of this issue:

What Chocolatey / BoxStarter reports ...

2022-08-14 14:05:03,891 6828 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2022-08-14 14:05:03,907 6828 [ERROR] - Second path fragment must not be a drive or UNC name.
Parameter name: path2

2022-08-14 14:05:03,970 6828 [ERROR] - More Details: System.ArgumentException: Second path fragment must not be a drive or UNC name.
Parameter name: path2
   at System.IO.Path.InternalCombine(String path1, String path2)
   at System.IO.FileSystemEnumerableIterator`1.GetFullSearchString(String fullPath, String searchPattern)
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.EnumerateFiles(String path, String searchPattern, SearchOption searchOption)
   at NuGet.PhysicalFileSystem.GetFiles(String path, String filter, Boolean recursive)
   at NuGet.LocalPackageRepository.<GetPackageFiles>d__31.MoveNext()
   at NuGet.LocalPackageRepository.<GetPackages>d__28.MoveNext()
   at NuGet.CollectionExtensions.AddRange[T](ICollection`1 collection, IEnumerable`1 items)
   at NuGet.LocalPackageRepository.FindPackagesById(Func`2 openPackage, String packageId)
   at NuGet.PackageRepositoryExtensions.FindPackagesById(IPackageRepository repository, String packageId)
   at NuGet.PackageRepositoryExtensions.FindPackage(IPackageRepository repository, String packageId, SemanticVersion version, IPackageConstraintProvider constraintProvider, Boolean allowPrereleaseVersions, Boolean allowUnlisted)
   at chocolatey.infrastructure.app.services.NugetService.upgrade_run(ChocolateyConfiguration config, Action`1 continueAction, Boolean performAction, Action`1 beforeUpgradeAction)
   at chocolatey.infrastructure.app.services.NugetService.upgrade_run(ChocolateyConfiguration config, Action`1 continueAction, Action`1 beforeUpgradeAction)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.perform_source_runner_function[T](ChocolateyConfiguration config, Func`2 function)
   at chocolatey.infrastructure.app.services.ChocolateyPackageService.upgrade_run(ChocolateyConfiguration config)
   at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boolean isConsole, Action`1 parseArgs)
   at chocolatey.infrastructure.app.runners.ConsoleApplication.run(String[] args, ChocolateyConfiguration config, Container container)
   at chocolatey.console.Program.Main(String[] args)
2022-08-14 14:05:03,970 6828 [DEBUG] - Exiting with 1

What causes the error ...

Very Important: Both commands work in PowerShell if you call choco directly:
(Please note the apostrophe ' in the --params parameter)

choco upgrade -y --acceptlicense AnyPackage --params "/Keyboard:fast /NewDirs:@('C:\Bin-Choco')"
choco upgrade -y --acceptlicense AnyPackage --params "'/Keyboard:fast /NewDirs:@('C:\Bin-Choco')'"

But in BoxStarter, one of both commands does not work:

  1. Call: Install-BoxstarterPackage -Package https://www..../Install-Boxstarter-Mini.ps1 -DisableReboots
  2. Content of Install-Boxstarter-Mini.ps1:
    # This creates the Exception: 
    # System.ArgumentException: Second path fragment must not be a drive or UNC name.
    # Parameter name: path2
    choco upgrade -y --acceptlicense AnyPackage --params "/Keyboard:fast /NewDirs:@('C:\Bin-Choco')"
    
    # If we add the apostrophe `'`, then it works:
    choco upgrade -y --acceptlicense AnyPackage --params "'/Keyboard:fast /NewDirs:@('C:\Bin-Choco')'"

Analysis of the cause

If everything perfectly works, the logfile displays:
PackageNames='Cfg-Win-Settings-Tom'|
If it fails, the logfile displays:
PackageNames='Cfg-Win-Settings-Tom;/NewDirs:@('C:\Bin-Choco')'|

So the error is:

  1. Error No1: the --params parser does not recognize the whole parameter
    Very likely because BoxStarter does not pass the parameters properly when calling Choco.
  2. Error No2: Coco or BoxStarter does not recognize when it should install a package that cannot exist because of a (parser) error: It really does not make any sense if Choco tries to install: /NewDirs:@('C:\Bin-Choco')'

What is Expected?

⚠️ This should be the basic concept:
If a choco command is perfectly working in the shell, then the same command must also work in BoxStarter.

Expectation of this issue:

  1. BoxStarter should always forward the parameters to choco the right way and never change what the user had defined 😄
  2. When an error happens and BoxStarter, or rather Choco, wants to install a package like /NewDirs:@('C:\Bin-Choco')', then this exception is generated:
    [ERROR] - More Details: System.ArgumentException: Second path fragment must not be a drive or UNC name.
    Parameter name: path2
    This exception should be caught and choco / boxstarter should indicate that the parameters have probably been defined incorrectly and that one should look at --params in particular.

How Did You Get This To Happen? (Steps to Reproduce)

  1. Create a BoxStarter Script which passes an array in --params and which does not have a ' delimiter:
    # This will create the error
    choco upgrade -y --acceptlicense AnyPackage --params "/Keyboard:fast /NewDirs:@('C:\Bin-Choco')"
    
    # With the `'` delimiters, BoxStarter perfectly passes the `--params` Argument to choco:
    # choco upgrade -y --acceptlicense AnyPackage --params "'/Keyboard:fast /NewDirs:@('C:\Bin-Choco')'"
  2. Call the script: Install-BoxstarterPackage -Package https://www..../Install-Boxstarter-Mini.ps1 -DisableReboots

System Details

  • OS Build: 10.0.19044.0
  • Windows PowerShell version:
Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
  • Chocolatey version: 1.1.0

Output Log

ℹ️ Search for this string: PackageNames='Cfg-Win-Settings-Tom;/NewDirs:@('C:\Bin-Choco')'|
» it should not recognize /NewDirs:@('C:\Bin-Choco')' as a package to install.

2022-08-14 14:04:52,329 8704 [DEBUG] - _ Chocolatey:ChocolateySourceCommand - Normal Run Mode _
2022-08-14 14:04:52,345 8704 [WARN ] - Nothing to change. Config already set.
2022-08-14 14:04:52,345 8704 [DEBUG] - Sending message 'PostRunMessage' out if there are subscribers...
2022-08-14 14:04:52,391 8704 [DEBUG] - Exiting with 0
2022-08-14 14:04:52,407 7700 [INFO ] - VERBOSE: Boxstarter: BoxstarterWrapper::Run => 
2022-08-14 14:04:52,407 7700 [INFO ] - VERBOSE: Boxstarter: restoring current directory location to C:\
2022-08-14 14:04:52,423 7700 [INFO ] - VERBOSE: Boxstarter: Parameters to be passed to Chocolatey: Command='upgrade', args='-dv -y --acceptlicense Cfg-Win-Settings-Tom --params /Keyboard:fast /NewDirs:@('C:\Bin-Choco')'
2022-08-14 14:04:52,438 7700 [INFO ] - VERBOSE: Boxstarter: Will stop on first package error: False
2022-08-14 14:04:52,438 7700 [INFO ] - VERBOSE: Boxstarter: RebootCodes: '3010 -2067919934' (2 elements)
2022-08-14 14:04:52,454 7700 [INFO ] - VERBOSE: Boxstarter: Installing 1 packages
2022-08-14 14:04:52,454 7700 [INFO ] - VERBOSE: Boxstarter: Checking for Pending reboot
2022-08-14 14:04:52,610 7700 [INFO ] - VERBOSE: Boxstarter: Detected Pending reboot
2022-08-14 14:04:52,641 7700 [INFO ] - + Boxstarter starting Calling Chocolatey to install Cfg-Win-Settings-Tom. This may take several minutes to complete...
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: p: -dv
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: p: -y
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: p: --acceptlicense
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: p: --params
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: p: /Keyboard:fast /NewDirs:@('C:\Bin-Choco')
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: Passing the following args to Chocolatey: @(upgrade Cfg-Win-Settings-Tom -dv -y --acceptlicense --params /Keyboard:fast /NewDirs:@('C:\Bin-Choco') -Source (removed sensitive configuration data) -Verbose)
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.Log from 7700 to $env:BEX.Boxstarter.Log with value C:\Users\ad\AppData\Local\Boxstarter\boxstarter.log
2022-08-14 14:04:52,641 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.ProgramFiles86 from 7700 to $env:BEX.Boxstarter.ProgramFiles86 with value C:\Program Files (x86)
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.SourcePID from 7700 to $env:BEX.Boxstarter.SourcePID with value 7020
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.SuppressLogging from 7700 to $env:BEX.Boxstarter.SuppressLogging with value False
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.RebootOk from 7700 to $env:BEX.Boxstarter.RebootOk with value False
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.Package from 7700 to $env:BEX.Boxstarter.Package with value tmpFE21.tmp
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.StopOnPackageFailure from 7700 to $env:BEX.Boxstarter.StopOnPackageFailure with value False
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.LocalRepo from 7700 to $env:BEX.Boxstarter.LocalRepo with value C:\ProgramData\Boxstarter\BuildPackages
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.NoPassword from 7700 to $env:BEX.Boxstarter.NoPassword with value True
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.NugetSources from 7700 to $env:BEX.Boxstarter.NugetSources with value (removed sensitive configuration data)
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.IsRebooting from 7700 to $env:BEX.Boxstarter.IsRebooting with value False
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.ScriptToCall from 7700 to $env:BEX.Boxstarter.ScriptToCall with value Import-Module (Join-Path -Path "C:\ProgramData\Boxstarter" -ChildPath BoxStarter.Chocolatey\Boxstarter.Chocolatey.psd1) -global -DisableNameChecking; Invoke-ChocolateyBoxstarter -bootstrapPackage 'https://www.akros.ch/it/Chocolatey/Install-Boxstarter-Akros-MA-Notebook-Web-Mini.ps1' -DisableReboots 
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported Boxstarter.BaseDir from 7700 to $env:BEX.Boxstarter.BaseDir with value C:\ProgramData\Boxstarter
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported VerbosePreference from 7700 to $env:BEX.VerbosePreference with value Continue
2022-08-14 14:04:52,657 7700 [INFO ] - VERBOSE: Boxstarter: Exported DebugPreference from 7700 to $env:BEX.DebugPreference with value Continue
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Boxstarter: Using current PowerShell...
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Loading module from path 'C:\ProgramData\Boxstarter\Boxstarter.chocolatey\Boxstarter.chocolatey.psd1'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'choco'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'cinst'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'cup'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Enable-BoxstarterClientRemoting'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Enable-BoxstarterCredSSP'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Export-BoxstarterVars'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Get-BoxStarterConfig'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Get-PackageRoot'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Install-BoxstarterPackage'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Install-ChocolateyInstallPackageOverride'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Invoke-BoxStarterBuild'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Invoke-BoxstarterFromTask'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Invoke-Chocolatey'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Invoke-ChocolateyBoxstarter'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'New-BoxstarterPackage'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'New-PackageFromScript'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Resolve-VMPlugin'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Set-BoxStarterConfig'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Set-BoxstarterShare'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing function 'Write-HostOverride'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing alias 'Enable-BoxstarterVM'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing alias 'Install-ChocolateyInstallPackage'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Importing alias 'Write-Host'.
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Boxstarter: Current runtime is 4.0.30319.42000
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Boxstarter: setting current directory location to C:\
2022-08-14 14:04:52,673 7700 [INFO ] - VERBOSE: Boxstarter: BoxstarterWrapper::Run(upgrade Cfg-Win-Settings-Tom -dv -y --acceptlicense --params /Keyboard:fast /NewDirs:@('C:\Bin-Choco') -Source (removed sensitive configuration data) -Verbose)...
2022-08-14 14:04:53,235 6828 [DEBUG] - XmlConfiguration is now operational
2022-08-14 14:04:53,485 6828 [INFO ] - ============================================================
2022-08-14 14:04:54,157 6828 [INFO ] - Chocolatey v1.1.0
2022-08-14 14:04:54,174 6828 [DEBUG] - Chocolatey is running on Windows v 10.0.19044.0
2022-08-14 14:04:54,174 6828 [DEBUG] - Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
2022-08-14 14:04:54,174 6828 [DEBUG] - Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
2022-08-14 14:04:54,174 6828 [DEBUG] - Command line: "C:\ProgramData\chocolatey\choco.exe" upgrade Cfg-Win-Settings-Tom -dv -y --acceptlicense --params /Keyboard:fast /NewDirs:@('C:\Bin-Choco') -Source (removed sensitive configuration data) -Verbose 
2022-08-14 14:04:54,189 6828 [DEBUG] - Received arguments: upgrade Cfg-Win-Settings-Tom -dv -y --acceptlicense --params /Keyboard:fast /NewDirs:@('C:\Bin-Choco') -Source (removed sensitive configuration data) -Verbose
2022-08-14 14:04:54,204 6828 [DEBUG] - RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
2022-08-14 14:04:54,235 6828 [DEBUG] - Sending message 'PreRunMessage' out if there are subscribers...
2022-08-14 14:04:54,235 6828 [DEBUG] - [Pending] Removing all pending packages that should not be considered installed...
2022-08-14 14:04:54,267 6828 [DEBUG] - Performing validation checks.
2022-08-14 14:04:54,282 6828 [DEBUG] - Global Configuration Validation Checks:
2022-08-14 14:04:54,282 6828 [DEBUG] -  - Package Exit Code / Exit On Reboot = Checked
2022-08-14 14:04:54,282 6828 [DEBUG] - System State Validation Checks:
2022-08-14 14:04:54,282 6828 [DEBUG] -  Reboot Requirement Checks:
2022-08-14 14:04:54,282 6828 [DEBUG] -  - Pending Computer Rename = Checked
2022-08-14 14:04:54,282 6828 [DEBUG] -  - Pending Component Based Servicing = Flagged
2022-08-14 14:04:54,282 6828 [INFO ] - 2 validations performed. 1 success(es), 1 warning(s), and 0 error(s).
2022-08-14 14:04:54,282 6828 [INFO ] - 
2022-08-14 14:04:54,298 6828 [WARN ] - Validation Warnings:
2022-08-14 14:04:54,298 6828 [WARN ] -  - A pending system reboot request has been detected, however, this is
   being ignored due to the current Chocolatey configuration.  If you
   want to halt when this occurs, then either set the global feature
   using:
     choco feature enable -name=exitOnRebootDetected
   or pass the option --exit-when-reboot-detected.

2022-08-14 14:04:54,298 6828 [DEBUG] - The source (removed sensitive configuration data) evaluated to a 'normal' source type
2022-08-14 14:04:54,298 6828 [DEBUG] - 

2022-08-14 14:04:54,298 6828 [DEBUG] - Configuration: CommandName='upgrade'|
CacheLocation='C:\Users\ad\AppData\Local\Temp\chocolatey\'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources=(removed sensitive configuration data)|

SourceType='normal'|Debug='True'|Verbose='True'|Trace='False'|
Force='False'|Noop='False'|HelpRequested='False'|
UnsuccessfulParsing='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='False'|DisableCompatibilityChecks='False'|
AcceptLicense='True'|AllowUnofficialBuild='False'|
Input='Cfg-Win-Settings-Tom /NewDirs:@('C:\Bin-Choco')'|
AllVersions='False'|
SkipPackageInstallProvider='False'|

PackageNames='Cfg-Win-Settings-Tom;/NewDirs:@('C:\Bin-Choco')'|

Prerelease='False'
|ForceX86='False'|OverrideArguments='False'|
NotSilent='False'|PackageParameters='/Keyboard:fast'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.19044.0'|
Information.PlatformName='Windows 10'|
Information.ChocolateyVersion='1.1.0.0'|
Information.ChocolateyProductVersion='1.1.0'|
Information.FullName='choco, Version=1.1.0.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='True'|
Information.UserName='ad'|Information.UserDomainName='W10TEST'|
Information.IsUserAdministrator='True'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='C:\'|Features.AutoUninstaller='True'|
Features.ChecksumFiles='True'|Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
ListCommand.LocalOnly='False'|ListCommand.IdOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.ByTagOnly='False'|ListCommand.IdStartsWith='False'|
ListCommand.OrderByPopularity='False'|ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|
TemplateCommand.Command='unknown'|
IF YOUR LOG CONTENT IS SHORT, PLACE IT HERE - WE NEED _ALL_ DETAILED OUTPUT BASED ON THE ABOVE TO BE ABLE TO PROVIDE SUPPORT (YOU WILL FIND THAT IN THE $env:ChocolateyInstall\logs\chocolatey.log between the `=====`)
IF YOUR LOG CONTENT IS LONG, PLEASE LINK TO A GIST (see https://docs.github.com/en/github/writing-on-github/editing-and-sharing-content-with-gists/creating-gists)

I just ran into this as well. Web searches turned up nothing.

pauby commented

Why are you passing this as a parameter /NewDirs:@('C:\Bin-Choco')?

pauby commented

@MisinformedDNA This is highlighted in the scripting guide.

Yep. Unfortunately, that assumes users understand best practices before using Boxstarter. The error has no way to lead to the best practices. Maybe certain errors can point to that page or have a troubleshooting page that highlights potential failure points when a user gets: "Second path fragment must not be a drive or UNC name"?

pauby commented

This isn't a Boxstarter issue. What I linked to was the Chocolatey best practices and that's where the parsing of the parameters takes place. PowerShell has a part to play here, and the quotes are used to prevent it getting in the way. Sometimes they are needed, sometimes not.

The error message isn't helpful, I agree. But that lies in Chocolatey itself. The best practices are documented, the examples on the Chocolatey docs website for the upgrade and install commands show the usage of the quotes. So I'm not sure what else to do here.

Given the question on quoting was answered over on the chocolatey/choco repository, and this is not a Boxstarter issue, I am going to go ahead and close it. But we can always reopen it later,