diff --git a/AutoTx-Updater/Update-Service.ps1 b/AutoTx-Updater/Update-Service.ps1 index db8e71c5525e750c191591a6611cbb6d01c0b7a6..18741128c96c092ee7ca6ac2567e5dd208b9818f 100644 --- a/AutoTx-Updater/Update-Service.ps1 +++ b/AutoTx-Updater/Update-Service.ps1 @@ -205,8 +205,14 @@ function Update-Configuration { function Copy-ServiceFiles { try { + Write-Verbose "Looking for source package using pattern: $($Pattern)" + $PkgDir = Get-ChildItem -Path $UpdateBinariesPath -Directory -Name | + Where-Object {$_ -match $Pattern} | + Sort-Object | + Select-Object -Last 1 + Write-Verbose "Update source package: $($PkgDir)" Copy-Item -Recurse -Force -ErrorAction Stop ` - -Path "$($UpdateBinariesPath)\$($ServiceName)\*" ` + -Path "$($UpdateBinariesPath)\$($PkgDir)\$($ServiceName)\*" ` -Destination "$InstallationPath" } catch { @@ -307,7 +313,7 @@ Check-ServiceState $ServiceName $UpdateConfigPath = "$($UpdateSourcePath)\Configs\$($env:COMPUTERNAME)" $UpdateMarkerPath = "$($UpdateSourcePath)\Service\UpdateMarkers" -$UpdateBinariesPath = "$($UpdateSourcePath)\Service\Binaries\Latest" +$UpdateBinariesPath = "$($UpdateSourcePath)\Service\Binaries" Exit-IfDirMissing $InstallationPath "installation" Exit-IfDirMissing $UpdateSourcePath "update source"