Freigeben über


ISubscription.SynchronizeAutomaticallyTimeOfDay Property

 

Applies To: Windows Server Update Services

Gets or sets the time of day when the WSUS server automatically synchronizes the updates.

Namespace:   Microsoft.UpdateServices.Administration
Assembly:  Microsoft.UpdateServices.Administration (in Microsoft.UpdateServices.Administration.dll)

Syntax

TimeSpan SynchronizeAutomaticallyTimeOfDay { get; set; }
property TimeSpan SynchronizeAutomaticallyTimeOfDay {
    TimeSpan get();
    void set(TimeSpan value);
}
abstract SynchronizeAutomaticallyTimeOfDay : TimeSpan with get, set
Property SynchronizeAutomaticallyTimeOfDay As TimeSpan

Property Value

Type: System.TimeSpan

Time of day when the WSUS server automatically synchronizes the updates. Specify the value as a time span since midnight. Express the time in Coordinated Universal Time (UTC). The smallest allowable unit of time is a second; fractions of a second will be truncated.

Exceptions

Exception

Condition

ArgumentOutOfRangeException

The time span cannot be greater than or equal to 24 hours or set to a negative time value.

Remarks

The time of day value is used only if SynchronizeAutomatically is true.

Note

WSUS stores the time in Coordinated Universal Time. This can affect the local time value that you display. For example, if the user wants the server to synchronize at 03:00 local time in a standard time zone that is 8 hours west of Coordinated Universal Time, you would set this property to 11:00 Coordinated Universal Time. When daylight saving time occurs, the server will continue to synchronize at 11:00 Coordinated Universal Time, however the local time value of this property will be 04:00.

Examples

The following example shows how to set SynchronizeAutomaticallyTimeOfDay The server variable that is used in the example is an instance of IUpdateServer (for information on retrieving an IUpdateServer instance, see Using the Windows Server Update Services 3.0 Class Library).

ISubscription subscription = server.GetSubscription();

subscription.SynchronizeAutomatically = true;

//Synchronize updates automatically at 4:30 every morning.
DateTime localSyncHour = DateTime.Today + new TimeSpan(4,30,0);

//WSUS stores dates and times in Coordinated Universal Time, 
//so convert the local time to Coordinated Universal Time.
subscription.SynchronizeAutomaticallyTimeOfDay = localSyncHour.ToUniversalTime().TimeOfDay;
subscription.Save;

The following example shows how to retrieve SynchronizeAutomaticallyTimeOfDay The server variable that is used in the example is an instance of IUpdateServer (for information on retrieving an IUpdateServer instance, see Using the Windows Server Update Services 3.0 Class Library).

ISubscription subscription = server.GetSubscription();

//WSUS stores dates and times in Coordinated Universal Time. 
//Convert the Coordinated Universal Time to local time and
//display the string.
DateTime syncHour = DateTime.Today + subscription.SynchronizeAutomaticallyTimeOfDay;
Console.WriteLine("Synchronize at {0} every day.", syncHour.ToLocalTime().ToShortTimeString());

See Also

ISubscription Interface
Microsoft.UpdateServices.Administration Namespace

Return to top