IUpdate.Approve(UpdateApprovalAction, IComputerTargetGroup, DateTime)

Approves an update for deployment to clients and provides a deadline by when the client must act on the update.

public IUpdateApproval Approve(
  UpdateApprovalAction action,
  IComputerTargetGroup targetGroup,
  DateTime deadline
);
Public Function Approve( _
  ByVal action As UpdateApprovalAction, _
  ByVal targetGroup As IComputerTargetGroup, _
  ByVal deadline As DateTime _
) As IUpdateApproval
Implements IUpdate.Approve

Parameters

  • action
    Action that clients should perform when applying the associated update. For example, installing or removing the update. For details, see UpdateApprovalAction.
  • targetGroup
    Target group to which you want to deploy the update.
  • deadline
    Date by when the client will be forced to apply the update if it has not already done so. DateTime.MaxValue indicates that there is no deadline. Specify the date in Coordinated Universal Time. The deadline applies only if the action is install or uninstall.

Return Values

An IUpdateApproval that represents the approval.

Exceptions

Exception type Condition
System.ArgumentOutOfRangeException The value for action is not valid. Only Install, Uninstall, Scan, and Block are valid values.
System.ArgumentNullException targetGroup cannot be null.
System.InvalidOperationException You can receive this exception because of either of the following reasons:

  • You must accept the license agreement for this update before you can approve the update for deployment.
  • You cannot approve the update if the server is a replica WSUS server (if IUpdateServerConfiguration.IsReplicaServer is true).
  • You can deploy an expired update only when action is UpdateApprovalAction.Uninstall. For information on expired updates, see IUpdate.PublicationState.
  • You cannot create a block approval to the All Computers target group.
  • The desired action cannot be used because a dependency has been approved for the opposite action.
WsusObjectNotFoundException The update or target group was not found in the database.

Remarks

You can approve an update for only a single action per target group. Approving the update for another action overrides the current approval.

A bundled update represents multiple child updates. The children updates may be explicitly or implicitly deployable. Approving a bundled update also approves its children.

Before approving an update for removal (setting action to UpdateApprovalAction.Uninstall), you should call IUpdate.UninstallationBehavior to verify that the update is removable. The update is removable if InstallationBehavior.IsSupported is true.

There are no restrictions on approving superseded updates. When you approve superseded updates, the client determines the correct update to install. This is often the safest course of action.

You can also approve different revisions of the same update for deployment to different groups; however, if one of the groups is the All Computers group, the approval actions cannot conflict (for example, you cannot approve one revision for installation and another revision for removal). You cannot approve different revisions of an update for deployment to the same group.

Approving different revisions of an update is typically done when you want to test the latest revision. In this case, you will deploy the latest revision to a test group for testing. Once testing is complete, you will remove the deployment to the test group and call IUpdate.RefreshUpdateApprovals() to move the deployment from the older revision to the latest revision.

Requirements

Server Requires Windows Server 2003 or Windows 2000 Server SP4 and later.
Namespace

Defined in Microsoft.UpdateServices.Administration.

Assembly

Requires Microsoft.UpdateServices.Administration (in Microsoft.UpdateServices.Administration.dll).

.NET Framework

Requires .NET Framework 1.1.

See Also

IUpdate.Decline, IUpdate.HasStaleUpdateApprovals, IUpdate.RefreshUpdateApprovals, IUpdate.GetUpdateApprovals