Contents

Method

GetStatus

ModulePatch
LibraryCore
Action

Report how updates are configured for the device.

Parameters

CabFilePath (string; default empty): If Source 'CAB' is to be searched for, the full path of the .cab-file.

If this is not given, no 'CAB' source will be sought.

If it is given, the path must be to a local CAB-file. Shared, i.e. remote, CAB-files are not supported by Windows Update Agent.

Return values

For each source of updates found on the device:

Source (string): Where the updates come from. One of:

  • CAB: A file with a .cab extension and appropriate binary structure containing update metadata, located somewhere in the file system available to the local agent. The file is used directly by the local Windows Update agent, without SCCM or WSUS being involved.
  • SCCM: System Center Configuration Manager.
  • WSUSL: A local (to the enterprise) corporate Windows Server Update Service server.
  • WSUSR: The remote Windows Server Update Service feed over the internet at microsoft.com .

SourceId (string): The identity of the source of updates. E.g. for a 'SCCM' source the site ID, or for WSUS the URL.

Configured (bool): Whether updates are configured from the source.

Enabled (bool): Whether updates are enabled from the source.

Prior to v4.2 for source WSUSR or WSUSL, an Enabled value of true may not be accurate; use Patch.TestConnection to accurately test whether the source can be accessed. From v4.2 onwards the 'Configure automatic updates' Group Policy setting is taken into account.

LastSuccessfulInstallTime (string): The time of the last successful update installation on the device.

The values for all sources can be the same because Windows Update (which is also used by SCCM) does not distinguish between sources when recording the last successful installation.

LastSuccessfulUpdateSearchTime (string): The time of the last successful search for updates for the device.

The values for sources CAB, WSUSL and WSUSR are the same because Windows Update does not distinguish between sources when recording the last successful search for updates.
Example

Find the devices and their sources where software updates are configured:

@patchStatus = Patch.GetStatus();
SELECT * FROM @patchStatus WHERE Configured = 1;
Platforms
  • Windows
Notes