catalog date

Re: catalog date

Postby boco » 20.03.2019, 23:56

The file modification date is no good indicator and can easily change, e. g. over FTP transfers, where the server doesn't support setting file times (will then become time of transfer). Plus, copying the catalog to a device with lower-precision timestamps (like FAT etc.) will modify it, too.
Microsoft update catalog:
Windows Install media download:
Posts: 2320
Joined: 24.11.2009, 17:00
Location: Germany

Re: catalog date

Postby WSUSUpdateAdmin » 26.03.2019, 15:04


Dalai wrote:The following code would work a little bit better, but it's still far from reliable:
Code: Select all
echo Reminding catalog date...
for /F "tokens=4*" %%i in ('%SIGCHK_PATH% /accepteula -q -nobanner ..\client\wsus\ ^| %SystemRoot%\System32\findstr.exe /I "Signing"') do (
  if NOT "%%~j"=="" (
      echo %%j>..\client\catalogdate.txt
  ) ELSE (
     echo %%i>..\client\catalogdate.txt

Batch is just so freaking limited...


Nearly exactly took this one for r1025. :)

Thanks & regards
Posts: 2245
Joined: 07.07.2009, 14:38

Re: catalog date

Postby hbuhrmester » 12.04.2019, 12:57

Another option would be the creation date of the file package.xml.

If the file package.xml is pretty-printed to package-formatted.xml, then the CreationDate is found in line 2, as an attribute of the first element OfflineSyncPackage:

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<OfflineSyncPackage xmlns="" MinimumClientVersion="" ProtocolVersion="1.0" PackageId="ec984487-b493-4c3a-bc8f-b27119c4e4aa" SourceId="cc56dcba-9026-4399-8535-7a3c9bed7086" CreationDate="2019-04-06T03:56:57Z" PackageVersion="1.1">

The CreationDate is in a well-defined format: ISO-8601 in UTC with date and time in seconds.

Relevant xkcd:

If we only need the date, we could use a simple combination of head, tail and grep:

Code: Select all
~/Projekte/wsusoffline/cache$ head -n 2 package-formatted.xml | tail -n 1 | grep -E --only-matching "[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}"

Of course, this does not work with the original file package.xml, because this file doesn't have any line breaks, and the whole file is just one long line.

To get the full date and time, we could use a simple xslt-Transformation file, which extracts only this one element:

Code: Select all
<?xml version="1.0"?>
<!-- Author: H. Buhrmester, 2019 -->
<!-- Filename: get-creation-date.xsl -->
<!-- This file extracts one attribute: -->
<!-- Field 1: OfflineSyncPackage/@CreationDate -->
<!-- Note: This xslt transformation file extracts a single value,
     and therefore it doesn't need a for-each loop like the other xslt
     files. -->
<xsl:stylesheet xmlns:xsl=""
  <xsl:output omit-xml-declaration="yes" indent="no" method="text" />
  <xsl:template match="/">
    <xsl:value-of select="__:OfflineSyncPackage/@CreationDate" />

Usage on Linux:

Code: Select all
~/Projekte/wsusoffline/cache$ xmlstarlet transform get-creation-date.xsl package.xml
Posts: 459
Joined: 11.10.2013, 20:59


Return to Download

Who is online

Users browsing this forum: No registered users and 19 guests