From 2af473ab169476c366fde12a513246d7b670cb67 Mon Sep 17 00:00:00 2001 From: Dan Gough Date: Thu, 5 Dec 2024 23:56:03 +0000 Subject: [PATCH] Add parameter transforms for Path and Transform with Execute-MSI --- .../PSScriptAnalyzer/Measure-ADTCompatibility.psm1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/PSAppDeployToolkit.Tools/PSScriptAnalyzer/Measure-ADTCompatibility.psm1 b/src/PSAppDeployToolkit.Tools/PSScriptAnalyzer/Measure-ADTCompatibility.psm1 index 15e44c8..fa2d663 100644 --- a/src/PSAppDeployToolkit.Tools/PSScriptAnalyzer/Measure-ADTCompatibility.psm1 +++ b/src/PSAppDeployToolkit.Tools/PSScriptAnalyzer/Measure-ADTCompatibility.psm1 @@ -723,11 +723,12 @@ function Measure-ADTCompatibility 'Execute-MSI' = @{ 'NewFunction' = 'Start-ADTMsiProcess' 'TransformParameters' = @{ - 'Path' = { "-FilePath $_" } + 'Path' = { if ($_ -match '^[''"]?\{?([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}\}?[''"]?$') { "-ProductCode $_" } else { "-FilePath $_" } } 'Arguments' = { "-ArgumentList $_" } 'Parameters' = { "-ArgumentList $_" } 'AddParameters' = { "-AdditionalArgumentList $_" } 'SecureParameters' = '-SecureArgumentList' # Should inspect switch values here in case of -Switch:$false + 'Transform' = { "-Transforms $(if ($_ -match "^'") { $_ -replace ';', "','" } elseif ($_ -match '^"') { $_ -replace ';', '","' } else { $_ })" } 'LogName' = { "-LogFileName $_" } 'IgnoreExitCodes' = { "-IgnoreExitCodes $($_.Trim('"').Trim("'") -split ',' -join ',')" } 'ExitOnProcessFailure' = {