lib/Compare-MachineTemplateDetail.ps1
function Compare-MachineTemplateDetail { <# .SYNOPSIS Compares the values from a Source Machine's Template with a chosen Base Template and the Parameters provided .DESCRIPTION This function compares and nicely formats the difference in a given property between the provided Launch Templates .PARAMETER MachineLaunchTemplate The MGN Source Machine Launch Template .PARAMETER BaseLaunchTemplate The Base Launch Template used as an override for the Machine's Launch Template .PARAMETER Params The Params Object provided in an applicable TM Action. The Params object contains values to add to the Machine's Launch Template .EXAMPLE $MergeSplat = @{ MachineLaunchTemplate = $MachineLaunchTemplate BaseLaunchTemplate = $BaseLaunchTemplate Params = $Params } Compare-MachineTemplateDetail $MergeSplat .OUTPUTS An updated LaunchTemplate object #> [CmdletBinding()] [OutputType([psobject])] # Add this if the function has an output param( [Parameter(Mandatory = $true, Position = 0)] [AllowEmptyString()] $Label, [Parameter(Mandatory = $false, Position = 1)] [AllowEmptyString()] $CurrentValue, [Parameter(Mandatory = $false, Position = 2)] [AllowEmptyString()] $TemplateValue, [Parameter(Mandatory = $false, Position = 3)] [AllowEmptyString()] $TMParamValue ) ## Write the values Write-Host $Label Write-Host "`tCurrent Value:`t`t" -ForegroundColor Green -NoNewline Write-Host $CurrentValue Write-Host "`tTemplate Value:`t`t" -ForegroundColor Cyan -NoNewline Write-Host $TemplateValue Write-Host "`tTM Param Value:`t`t" -ForegroundColor Yellow -NoNewline Write-Host $TMParamValue } |