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:

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