Skip to content

[Bug] Splatting is not picked up when running Convert-ADTDeployment #12

@PZan

Description

@PZan

Prerequisites

PSAppDeployToolkit.Tools version

0.2.3

PSAppDeployToolkit version

4.0.5

Describe the bug

I did scroll through all issues, and I don't think there's any reports of this one. Excuse me if I'm mistaken.

I attempted converting a package and upon inspecting the results i noticed that splats weren't included in the converted command. Here's an example:

$InstallSplat = @{
	Path = Join-Path $dirFiles -ChildPath "Setup.exe"
	Parameters = "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /LOG=`"$($configToolkitLogDir)\$($appName)_$($appVersion)_install_exe.log`""
}
Execute-Process @InstallSplat

got converted to

$InstallSplat = @{
	Path = Join-Path $adtSession.DirFiles -ChildPath "Setup.exe"
	Parameters = "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /LOG=`"$(if ($isAdmin) { (Get-ADTConfig).Toolkit.LogPath } else { (Get-ADTConfig).Toolkit.LogPathNoAdminRights })\$($adtSession.AppName)_$($adtSession.AppVersion)_install_exe.log`""
}
Start-ADTProcess 

As you can see there's actually two issues here:

  • InstallSplat hashtable isn't added to the Start-ADTProcess command.
  • The variables within the splat aren't converted, as these should now be FilePath and ArgumentList.

I haven't dived much deeper into this, but VSCode quickly had me on alert as it warned me about unused variables. My team is heavily into splatting, so adding support for this would be much appreciated.

Also pretty gnarly conversion of the value for the Parameters variable :)

Steps to reproduce

Explained in description

Environment data

OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-biters
WindowsVersion       : 2009
WindowsProductName   : Windows 10 Enterprise
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : nb-NO
OsMuiLanguages       : {nb-NO}
KeyboardLayout       : nb-NO
TimeZone             : (UTC+01:00) Amsterdam, Berlin, Bern, Oslo, Roma, Wien
HyperVisorPresent    : True
CsPartOfDomain       : False
CsPCSystemType       : Mobile

dotnet: The term 'dotnet' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions