function Set-LastBuiltVersion { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$StateFilePath, [Parameter(Mandatory = $true)] [string]$Version ) $parent = Split-Path -Parent $StateFilePath if (-not (Test-Path -LiteralPath $parent)) { New-Item -Path $parent -ItemType Directory -Force | Out-Null } Set-Content -LiteralPath $StateFilePath -Value $Version -Encoding Ascii }