catalog date

catalog date

Postby negg » 14.03.2019, 18:08

Dont know where to put this one but my catalog date always says "am" and nothing else. any ideas why ?
negg
 
Posts: 222
Joined: 26.03.2014, 11:46

Re: catalog date

Postby Dalai » 14.03.2019, 18:39

Which Windows version are you using? Which locale are you using? Please also provide the output of the following command:
Code: Select all
wsusoffline\bin\sigcheck.exe /accepteula -q -nobanner wsusoffline\client\wsus\wsusscn2.cab
Change the paths if necessary.

Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: catalog date

Postby boco » 14.03.2019, 20:08

@Dalai: I have the same problem. Wanted to report it a long time ago, but forgot.

Code: Select all
Q:\wsusupdate>bin\sigcheck.exe /accepteula -q -nobanner client\wsus\wsusscn2.cab
Q:\wsusupdate\client\wsus\wsusscn2.cab:
        Verified:       Signed
        Signing date:   12:10 PM 2019-03-12
        Publisher:      Microsoft Corporation
        Company:        n/a
        Description:    n/a
        Product:        n/a
        Prod version:   n/a
        File version:   n/a
        MachineType:    n/a


I guess it has to do with WOU not parsing time strings with AM and PM correctly.
Microsoft update catalog: http://catalog.update.microsoft.com/v7/site/
Windows Install media download: https://support.microsoft.com/en-us/help/15088/windows-create-installation-media
boco
 
Posts: 2391
Joined: 24.11.2009, 17:00
Location: Germany

Re: catalog date

Postby Dalai » 14.03.2019, 20:54

This is what it looks like on a German system:
Code: Select all
S:\Programme\WSUS Offline Update\#catalog\wsusscn2 [2019-01].cab:
        Verified:       Signed
        Signing date:   11:29 07.01.2019
        Publisher:      Microsoft Corporation
        Company:        n/a
        Description:    n/a
        Product:        n/a
        Prod version:   n/a
        File version:   n/a
        MachineType:    n/a
OK, so this issue can occur depending on the locale, or rather, regional setting (time format), just as I thought.

Responsible for extracting the catalog date is wsusoffline\cmd\DownloadUpdates.cmd, specifically this part
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 (
  echo %%i>..\client\catalogdate.txt
)
This works correctly when the 4th token is the date. I'm not sure how the code could be changed to make it work correctly on any locale/times format. If the for-loop would support negative token positions (1st from the right), or if Sigcheck would output the date first (and the time after that), everything would be fine...

For my own scripts, I just use sed(.exe) which makes it really easy to manipulate output and/or text files.

Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: catalog date

Postby Dalai » 14.03.2019, 21:12

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
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: catalog date

Postby negg » 20.03.2019, 10:41

Seems to be a pointless bit of code then id just remove it from next version if it does not work as planned
negg
 
Posts: 222
Joined: 26.03.2014, 11:46

Re: catalog date

Postby boco » 20.03.2019, 14:01

Showing the catalog date is not pointless at all. MS regularly releases new catalogs and not all of them are trouble-free.
Microsoft update catalog: http://catalog.update.microsoft.com/v7/site/
Windows Install media download: https://support.microsoft.com/en-us/help/15088/windows-create-installation-media
boco
 
Posts: 2391
Joined: 24.11.2009, 17:00
Location: Germany

Re: catalog date

Postby Dalai » 20.03.2019, 16:34

Well, instead of trying to extract the date only, the code could be changed to extract everything. First option to do so is to replace - i.e. cut - the "Signing date:" string, like so:
Code: Select all
echo Reminding catalog date...
setlocal EnableDelayedExpansion
for /F "delims=" %%i in ('%SIGCHK_PATH% /accepteula -q -nobanner ..\client\wsus\wsusscn2.cab ^| %SystemRoot%\System32\findstr.exe /I "Signing"') do (
  set "d=%%~i"
  set "d=!d:Signing date:=!"
  echo !d!>..\client\catalogdate.txt
)
endlocal
And later in the AutoIT script, call StringStripWS() function to remove the leading spaces before showing the string.

Another option: If the position/offset of Sigcheck output is constant, something like this would also work:
Code: Select all
echo Reminding catalog date...
setlocal EnableDelayedExpansion
for /F "delims=" %%i in ('%SIGCHK_PATH% /accepteula -q -nobanner ..\client\wsus\wsusscn2.cab ^| %SystemRoot%\System32\findstr.exe /I "Signing"') do (
  set "d=%%~i"
  set "d=!d:~15!"
  echo !d!>..\client\catalogdate.txt
)
endlocal
or whatever offset value fits.

One thing is for sure: It won't get any nicer with Batch only mechanisms...

Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Re: catalog date

Postby negg » 20.03.2019, 21:44

would this do ????? just need to change path of wsusscn2.cab

Code: Select all
@echo off
 
@SETLOCAL ENABLEDELAYEDEXPANSION
 
for %%a in (wsusscn2.cab) do (
  set myfiledate=%%~ta
  echo !myfiledate!
)
negg
 
Posts: 222
Joined: 26.03.2014, 11:46

Re: catalog date

Postby Dalai » 20.03.2019, 23:08

@negg:
Theoretically, yes, %%~ti would suffice. I thought about that, too. The problem is that the file date can be different from the signing date of the file, and can even be changed manually, e.g. with programs that can change file modification dates, like any good file manager (Total Commander ;)). The file signing date stays the same until the file/catalog is updated (or it becomes corrupted).

Regards
Dalai
Dalai
 
Posts: 1041
Joined: 12.07.2016, 21:00

Next

Return to Download

Who is online

Users browsing this forum: No registered users and 53 guests