@@ -26,6 +26,8 @@ function Measure-ADTCompatibility
2626
2727 Begin
2828 {
29+ if ($ScriptBlockAst.Parent ) { return } # Only process the root ScriptBlockAst
30+
2931 # region PSAppDeployToolkit v3.10.2 Function Definitions
3032 function Write-FunctionHeaderOrFooter
3133 {
@@ -1582,7 +1584,7 @@ function Measure-ADTCompatibility
15821584 )
15831585 }
15841586 ' Exit-Script' = @ {
1585- ' NewFunction' = ' Exit-ADTScript '
1587+ ' NewFunction' = ' Close-ADTSession '
15861588 }
15871589 ' Invoke-HKCURegistrySettingsForAllUsers' = @ {
15881590 ' NewFunction' = ' Invoke-ADTAllUsersRegistryAction'
@@ -1850,6 +1852,7 @@ function Measure-ADTCompatibility
18501852 ' TransformParameters' = @ {
18511853 ' Icon' = { if ($_ -ne ' None' ) { " -Icon $_ " } }
18521854 ' ExitOnTimeout' = { if ($_ -eq ' $false' ) { ' -NoExitOnTimeout' } }
1855+ ' MinimizeWindows' = { if ($_ -eq ' $true' ) { ' -MinimizeWindows' } }
18531856 ' TopMost' = { if ($_ -eq ' $false' ) { ' -NotTopMost' } }
18541857 }
18551858 }
@@ -1866,17 +1869,23 @@ function Measure-ADTCompatibility
18661869 ' TopMost' = { if ($_ -eq ' $false' ) { ' -NotTopMost' } }
18671870 }
18681871 }
1872+ ' Get-RunningProcesses' = @ {
1873+ ' NewFunction' = ' Get-ADTRunningProcesses'
1874+ ' TransformParameters' = @ {
1875+ ' DisableLogging' = ' -InformationAction SilentlyContinue'
1876+ }
1877+ }
18691878 ' Show-InstallationWelcome' = @ {
18701879 ' NewFunction' = ' Show-ADTInstallationWelcome'
18711880 ' TransformParameters' = @ {
1872- ' MinimizeWindows' = { if ($_ -eq ' $false ' ) { ' -NoMinimizeWindows ' } }
1881+ ' MinimizeWindows' = { if ($_ -eq ' $true ' ) { ' -MinimizeWindows ' } }
18731882 ' TopMost' = { if ($_ -eq ' $false' ) { ' -NotTopMost' } }
18741883 ' CloseAppsCountdown' = { " -CloseProcessesCountdown $_ " }
18751884 ' ForceCloseAppsCountdown' = { " -ForceCloseProcessesCountdown $_ " }
18761885 ' AllowDeferCloseApps' = ' -AllowDeferCloseProcesses' # Should inspect switch values here in case of -Switch:$false
18771886 ' CloseApps' = {
18781887 $quoteChar = if ($boundParameters.CloseApps.Value.StringConstantType -eq ' DoubleQuoted' ) { ' "' } else { " '" }
1879- $closeProcesses = $_.Trim (' "' ).Trim(" '" ) -split ' ,' | & {
1888+ $closeProcesses = $_.ToString (). Trim(' "' ).Trim(" '" ) -split ' ,' | & {
18801889 process
18811890 {
18821891 $name , $description = $_ -split ' ='
@@ -1900,6 +1909,9 @@ function Measure-ADTCompatibility
19001909 ' TransformParameters' = @ {
19011910 ' DisableFunctionLogging' = ' -InformationAction SilentlyContinue' # Should inspect switch values here in case of -Switch:$false
19021911 }
1912+ ' RemoveParameters' = @ (
1913+ ' GetAllWindowTitles'
1914+ )
19031915 }
19041916 ' Show-InstallationRestartPrompt' = @ {
19051917 ' NewFunction' = ' Show-ADTInstallationRestartPrompt'
@@ -1919,6 +1931,9 @@ function Measure-ADTCompatibility
19191931 }
19201932 ' Remove-ContentFromCache' = @ {
19211933 ' NewFunction' = ' Remove-ADTContentFromCache'
1934+ ' TransformParameters' = @ {
1935+ ' Path' = { " -LiteralPath $_ " }
1936+ }
19221937 }
19231938 ' Test-NetworkConnection' = @ {
19241939 ' NewFunction' = ' Test-ADTNetworkConnection'
@@ -1941,6 +1956,7 @@ function Measure-ADTCompatibility
19411956 ' New-Folder' = @ {
19421957 ' NewFunction' = ' New-ADTFolder'
19431958 ' TransformParameters' = @ {
1959+ ' Path' = { " -LiteralPath $_ " }
19441960 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
19451961 }
19461962 }
@@ -1988,7 +2004,9 @@ function Measure-ADTCompatibility
19882004 )
19892005 }
19902006 ' Resolve-Error' = @ {
1991- ' NewFunction' = ' Resolve-ADTErrorRecord'
2007+ ' NewFunction' = {
2008+ if ($boundParameters.ContainsKey (' ErrorRecord' )) { ' Resolve-ADTErrorRecord' } else { ' $Error[0] | Resolve-ADTErrorRecord' }
2009+ }
19922010 ' AddParameters' = @ {
19932011 ' ExcludeErrorRecord' = {
19942012 if (! $boundParameters.ContainsKey (' GetErrorRecord' ) -or $boundParameters.GetErrorRecord.ConstantValue -eq $false -or $boundParameters.GetErrorRecord.Value.Extent.Text -eq ' $false' ) { ' -ExcludeErrorRecord' }
@@ -2003,6 +2021,12 @@ function Measure-ADTCompatibility
20032021 if (! $boundParameters.ContainsKey (' GetErrorInnerException' ) -or $boundParameters.GetErrorInnerException.ConstantValue -eq $false -or $boundParameters.GetErrorInnerException.Value.Extent.Text -eq ' $false' ) { ' -ExcludeErrorInnerException' }
20042022 }
20052023 }
2024+ ' RemoveParameters' = @ (
2025+ ' GetErrorRecord'
2026+ ' GetErrorInvocation'
2027+ ' GetErrorException'
2028+ ' GetErrorInnerException'
2029+ )
20062030 }
20072031 ' Get-ServiceStartMode' = @ {
20082032 ' NewFunction' = ' Get-ADTServiceStartMode'
@@ -2031,6 +2055,9 @@ function Measure-ADTCompatibility
20312055 ' Arguments' = { " -ArgumentList $_ " }
20322056 ' Parameters' = { " -ArgumentList $_ " }
20332057 ' SecureParameters' = ' -SecureArgumentList' # Should inspect switch values here in case of -Switch:$false
2058+ ' UseShellExecute' = { if ($_ -eq ' $true' ) { ' -UseShellExecute' } }
2059+ ' WindowStyle' = { if (! $boundParameters.CreateNoWindow.ConstantValue ) { " -WindowStyle $_ " } } # Remove WindowStyle if CreateNoWindow is set
2060+ ' MsiExecWaitTime' = { " -MsiExecWaitTime ([System.TimeSpan]::FromSeconds($_ ))" }
20342061 ' IgnoreExitCodes' = { " -IgnoreExitCodes $ ( $_.Trim (' "' ).Trim(" '" ) -split ' ,' -join ' ,' ) " }
20352062 ' ExitOnProcessFailure' = {
20362063 $ContinueOnError = if ($null -eq $boundParameters.ContinueOnError.Value.Extent ) { $false } else { $boundParameters.ContinueOnError.Value.SafeGetValue () }
@@ -2071,6 +2098,7 @@ function Measure-ADTCompatibility
20712098 ' NewFunction' = ' Start-ADTMspProcess'
20722099 ' TransformParameters' = @ {
20732100 ' Path' = { " -FilePath $_ " }
2101+ ' AddParameters' = { " -AdditionalArgumentList $_ " }
20742102 }
20752103 }
20762104 ' Block-AppExecution' = @ {
@@ -2123,6 +2151,7 @@ function Measure-ADTCompatibility
21232151 ' Set-RegistryKey' = @ {
21242152 ' NewFunction' = ' Set-ADTRegistryKey'
21252153 ' TransformParameters' = @ {
2154+ ' Key' = { " -LiteralPath $_ " }
21262155 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
21272156 }
21282157 }
@@ -2143,6 +2172,7 @@ function Measure-ADTCompatibility
21432172 ' Get-RegistryKey' = @ {
21442173 ' NewFunction' = ' Get-ADTRegistryKey'
21452174 ' TransformParameters' = @ {
2175+ ' Key' = { " -LiteralPath $_ " }
21462176 ' Value' = { " -Name $_ " }
21472177 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
21482178 }
@@ -2151,7 +2181,7 @@ function Measure-ADTCompatibility
21512181 ' NewFunction' = ' Install-ADTMSUpdates'
21522182 }
21532183 ' Get-SchedulerTask' = @ {
2154- ' NewFunction' = ' Get-ADTSchedulerTask '
2184+ ' NewFunction' = ' Get-ScheduledTask '
21552185 ' TransformParameters' = @ {
21562186 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
21572187 }
@@ -2195,8 +2225,9 @@ function Measure-ADTCompatibility
21952225 ' NewFunction' = ' Set-ADTItemPermission'
21962226 ' TransformParameters' = @ {
21972227 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
2198- ' File' = { " -Path $_ " }
2199- ' Folder' = { " -Path $_ " }
2228+ ' File' = { " -LiteralPath $_ " }
2229+ ' Folder' = { " -LiteralPath $_ " }
2230+ ' Path' = { " -LiteralPath $_ " }
22002231 ' Username' = { " -User $_ " }
22012232 ' Users' = { " -User $_ " }
22022233 ' SID' = { " -User $_ " }
@@ -2232,31 +2263,42 @@ function Measure-ADTCompatibility
22322263 }
22332264 ' Send-Keys' = @ {
22342265 ' NewFunction' = ' Send-ADTKeys'
2266+ ' TransformParameters' = @ {
2267+ ' WaitSeconds' = { " -WaitDuration ([System.TimeSpan]::FromSeconds($_ ))" }
2268+ }
22352269 }
22362270 ' Get-Shortcut' = @ {
22372271 ' NewFunction' = ' Get-ADTShortcut'
22382272 ' TransformParameters' = @ {
2273+ ' Path' = { " -LiteralPath $_ " }
22392274 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
22402275 }
22412276 }
22422277 ' Set-Shortcut' = @ {
22432278 ' NewFunction' = ' Set-ADTShortcut'
22442279 ' TransformParameters' = @ {
2280+ ' Path' = { " -LiteralPath $_ " }
22452281 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
22462282 }
22472283 }
22482284 ' New-Shortcut' = @ {
22492285 ' NewFunction' = ' New-ADTShortcut'
22502286 ' TransformParameters' = @ {
2287+ ' Path' = { " -LiteralPath $_ " }
2288+ ' RunAsAdmin' = { if ($_ -eq ' $true' ) { ' -RunAsAdmin' } }
22512289 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
22522290 }
22532291 }
22542292 ' Execute-ProcessAsUser' = @ {
22552293 ' NewFunction' = ' Start-ADTProcessAsUser'
2294+ ' AddParameters' = @ {
2295+ ' NoWait' = { if (! $boundParameters.Wait.ConstantValue ) { ' -NoWait' } }
2296+ }
22562297 ' TransformParameters' = @ {
22572298 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
22582299 }
22592300 ' RemoveParameters' = @ (
2301+ ' Wait'
22602302 ' TempPath'
22612303 ' RunLevel'
22622304 )
@@ -2279,6 +2321,7 @@ function Measure-ADTCompatibility
22792321 ' Get-MsiTableProperty' = @ {
22802322 ' NewFunction' = ' Get-ADTMsiTableProperty'
22812323 ' TransformParameters' = @ {
2324+ ' Path' = { " -LiteralPath $_ " }
22822325 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
22832326 }
22842327 }
@@ -2290,6 +2333,9 @@ function Measure-ADTCompatibility
22902333 }
22912334 ' Get-MsiExitCodeMessage' = @ {
22922335 ' NewFunction' = ' Get-ADTMsiExitCodeMessage'
2336+ ' TransformParameters' = @ {
2337+ ' MsiErrorCode' = { " -MsiExitCode $_ " }
2338+ }
22932339 }
22942340 ' Get-ObjectProperty' = @ {
22952341 ' NewFunction' = ' Get-ADTObjectProperty'
@@ -2300,11 +2346,16 @@ function Measure-ADTCompatibility
23002346 ' Get-PEFileArchitecture' = @ {
23012347 ' NewFunction' = ' Get-ADTPEFileArchitecture'
23022348 ' TransformParameters' = @ {
2349+ ' FilePath' = { " -LiteralPath $_ " }
2350+ ' Path' = { " -LiteralPath $_ " }
23032351 ' ContinueOnError' = { if ($_ -eq ' $true' ) { ' -ErrorAction SilentlyContinue' } else { ' -ErrorAction Stop' } }
23042352 }
23052353 }
23062354 ' Test-IsMutexAvailable' = @ {
23072355 ' NewFunction' = ' Test-ADTMutexAvailability'
2356+ ' TransformParameters' = @ {
2357+ ' MutexWaitTimeInMilliseconds' = { " -MutexWaitTime ([System.TimeSpan]::FromMilliseconds($_ ))" }
2358+ }
23082359 }
23092360 ' New-ZipFile' = @ {
23102361 ' NewFunction' = ' New-ADTZipFile'
@@ -2915,7 +2966,11 @@ function Measure-ADTCompatibility
29152966 else
29162967 {
29172968 # This is a regular parameter, e.g. -Path 'xxx'
2918- $newParam = " -$ ( $boundParameter.Key ) $ ( $boundParameter.Value.Value.Extent.Text ) "
2969+ $newParam = " -$ ( $boundParameter.Key ) "
2970+ if (! [string ]::IsNullOrWhiteSpace($boundParameter.Value.Value.Extent.Text ))
2971+ {
2972+ $newParam += " $ ( $boundParameter.Value.Value.Extent.Text ) "
2973+ }
29192974 }
29202975 }
29212976
@@ -2947,7 +3002,11 @@ function Measure-ADTCompatibility
29473002 }
29483003
29493004 # Construct the new command
2950- $newCommand = $newFunction + ' ' + ($newParams -join ' ' )
3005+ $newCommand = $newFunction
3006+ if ($newParams.Count -gt 0 )
3007+ {
3008+ $newCommand = $newCommand + ' ' + ($newParams -join ' ' )
3009+ }
29513010
29523011 # Create a CorrectionExtent object for the suggested correction
29533012 $objParams = @ {
0 commit comments