diff --git a/changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml b/changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml new file mode 100644 index 00000000000..89bea175972 --- /dev/null +++ b/changelogs/fragments/win_get_url_fix_timestamp_comparison.yaml @@ -0,0 +1,2 @@ +bugfixes: +- win_get_url - Compare the UTC time of the web file to the local UTC time (https://github.com/ansible/ansible/pull/39152) diff --git a/lib/ansible/modules/windows/win_get_url.ps1 b/lib/ansible/modules/windows/win_get_url.ps1 index 7047f8a7dad..1cf4ef5d0fb 100644 --- a/lib/ansible/modules/windows/win_get_url.ps1 +++ b/lib/ansible/modules/windows/win_get_url.ps1 @@ -71,7 +71,7 @@ Function CheckModified-File($url, $dest, $headers, $credentials, $timeout, $use_ $result.msg = $webResponse.StatusDescription $webResponse.Close() - if ($webLastMod -and ((Get-Date -Date $webLastMod) -lt $fileLastMod)) { + if ($webLastMod -and ((Get-Date -Date $webLastMod).ToUniversalTime() -lt $fileLastMod)) { return $false } else { return $true