locked
Check the download status of WSUS from the api RRS feed

  • Question

  • Hi I am using the WSUS sdk to initiate a sync from another application. using the sdk i can only check if sync is completed. however in some cases the sync is completed but the WSUS server still has to download the patches.

    using the SDK how can i check is sync and all downloads are completed 

    Check if sync is completed:

    IUpdateServer updateServer = AdminProxy.GetUpdateServer(clientWsusIp, false, clientWsusPort);

    ISubscription subscription = updateServer.GetSubscription();

    SynchronizationProgress syncProgress = subscription.GetSynchronizationProgress();

    if (syncProgress.Phase != SynchronizationPhase.NotProcessing)
    {

    //sync is in progress

    }

    //sync is completed (metadata) but WSUS may still be downloading patches

    Cheers

    Tuesday, January 20, 2015 12:55 PM

Answers

  • TotalBytesToDownload equal to DownloadedBytes  probably means that download is finished. You can also get the list of updates and check update's State property: NotReady means update is not downloaded.

    Gleb.

    • Marked as answer by AnnaWY Monday, February 2, 2015 7:50 AM
    Tuesday, January 20, 2015 2:10 PM
  • but the downloadprog.DownloadedBytes and downloadprog.TotalBytesToDownload are always equal even if WSUS sync is not running

    Agree with Gleb: The downloads are complete; most likely there were never any downloads to perform.

    Those values contain data from the last file download session -- whenever it might have been.

    The SYNC does not trigger downloads (well, except for occasionally a TXT file for a EULA), or if you have any automatic approval rules in place -- but generally that's only going to happen once a month (unless Definition Updates are also part of the mix).

    Downloads are actually triggered by the act of approving updates, so in the absence of any automatic approval rules, the SYNC will not generate downloads.


    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

    • Marked as answer by AnnaWY Monday, February 2, 2015 7:50 AM
    Tuesday, January 20, 2015 3:21 PM

All replies

  • Use GetContentDownloadProgress method of updateServer to check .

    Gleb.

    Tuesday, January 20, 2015 1:45 PM
  • I did 

    ContentDownloadProgress downloadprog = updateServer.GetContentDownloadProgress();

    but the downloadprog.DownloadedBytes and downloadprog.TotalBytesToDownload are always equal even if WSUS sync is not running

    Tuesday, January 20, 2015 1:55 PM
  • TotalBytesToDownload equal to DownloadedBytes  probably means that download is finished. You can also get the list of updates and check update's State property: NotReady means update is not downloaded.

    Gleb.

    • Marked as answer by AnnaWY Monday, February 2, 2015 7:50 AM
    Tuesday, January 20, 2015 2:10 PM
  • but the downloadprog.DownloadedBytes and downloadprog.TotalBytesToDownload are always equal even if WSUS sync is not running

    Agree with Gleb: The downloads are complete; most likely there were never any downloads to perform.

    Those values contain data from the last file download session -- whenever it might have been.

    The SYNC does not trigger downloads (well, except for occasionally a TXT file for a EULA), or if you have any automatic approval rules in place -- but generally that's only going to happen once a month (unless Definition Updates are also part of the mix).

    Downloads are actually triggered by the act of approving updates, so in the absence of any automatic approval rules, the SYNC will not generate downloads.


    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

    • Marked as answer by AnnaWY Monday, February 2, 2015 7:50 AM
    Tuesday, January 20, 2015 3:21 PM
  • Thank you both Lawrence and Gleb :-) for your quick response it is really helpful  

    would you say that the following code cover all bases ?

    IUpdateServer updateServer = AdminProxy.GetUpdateServer(clientWsusIp, false, clientWsusPort);
    ISubscription subscription = updateServer.GetSubscription();
    SynchronizationProgress syncProgress = subscription.GetSynchronizationProgress();
    ContentDownloadProgress  downloadprog = updateServer.GetContentDownloadProgress();
    if (syncProgress.Phase != SynchronizationPhase.NotProcessing || downloadprog.DownloadedBytes != downloadprog.TotalBytesToDownload){
          //WSUS is either syncing or downloading patches
    }else{
          //WSUS is not syncing or downloading 
    }
    Thanks again!!!

    Wednesday, January 21, 2015 8:17 AM
  • would you say that the following code cover all bases ?

    I would suggest that the proper test is

    downloadprog.DownloadedBytes < downloadprog.TotalBytesToDownload)

    rather than an inequality test.

    Otherwise, it seems to make sense.


    Lawrence Garvin, M.S., MCSA, MCITP:EA, MCDBA
    SolarWinds Head Geek
    Microsoft MVP - Software Packaging, Deployment & Servicing (2005-2014)
    My MVP Profile: http://mvp.microsoft.com/en-us/mvp/Lawrence%20R%20Garvin-32101
    http://www.solarwinds.com/gotmicrosoft
    The views expressed on this post are mine and do not necessarily reflect the views of SolarWinds.

    Wednesday, January 21, 2015 2:08 PM
  • Thanks again this was very helpful !! :-)

    Thursday, January 22, 2015 11:53 AM
  • Hi SagitEfrati,

    I‘m writing to check if this issue has been solved, if you have any questions, please feel free to let me know.

    If you have any feedback on our support, please click here.

    Best Regards,

    Anna


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com

    • Edited by AnnaWY Tuesday, January 27, 2015 7:23 AM
    Tuesday, January 27, 2015 7:23 AM