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\wsusscn2.cab ^| %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...
Regards
Dalai
<?xml version="1.0" encoding="utf-8"?>
<OfflineSyncPackage xmlns="http://schemas.microsoft.com/msus/2004/02/OfflineSync" MinimumClientVersion="5.8.0.2678" ProtocolVersion="1.0" PackageId="ec984487-b493-4c3a-bc8f-b27119c4e4aa" SourceId="cc56dcba-9026-4399-8535-7a3c9bed7086" CreationDate="2019-04-06T03:56:57Z" PackageVersion="1.1">
~/Projekte/wsusoffline/cache$ head -n 2 package-formatted.xml | tail -n 1 | grep -E --only-matching "[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}"
2019-04-06
<?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="http://www.w3.org/1999/XSL/Transform"
xmlns:__="http://schemas.microsoft.com/msus/2004/02/OfflineSync"
version="1.0">
<xsl:output omit-xml-declaration="yes" indent="no" method="text" />
<xsl:template match="/">
<xsl:value-of select="__:OfflineSyncPackage/@CreationDate" />
<xsl:text> </xsl:text>
</xsl:template>
</xsl:stylesheet>
~/Projekte/wsusoffline/cache$ xmlstarlet transform get-creation-date.xsl package.xml
2019-04-06T03:56:57Z
Users browsing this forum: No registered users and 8 guests