UpdateInstallationInfoCollection Class
Applies To: Windows Server Update Services
Collection of update installation information. To retrieve this collection, call one of the following methods: GetUpdateInstallationInfoPerUpdate; GetUpdateInstallationInfoPerComputerTarget.GetUpdateInstallationInfoPerComputerTarget.
Namespace: Microsoft.UpdateServices.Administration
Assembly: Microsoft.UpdateServices.Administration (in Microsoft.UpdateServices.Administration.dll)
Inheritance Hierarchy
System.Object
System.Collections.CollectionBase
Microsoft.UpdateServices.Administration.WsusCollection
Microsoft.UpdateServices.Administration.UpdateInstallationInfoCollection
Syntax
[SerializableAttribute]
[GuidAttribute("DF2C80AA-B24F-4C3D-B4D4-9A09DDDC1FA0")]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[ComVisibleAttribute(true)]
public class UpdateInstallationInfoCollection : WsusCollection
[SerializableAttribute]
[GuidAttribute("DF2C80AA-B24F-4C3D-B4D4-9A09DDDC1FA0")]
[ClassInterfaceAttribute(ClassInterfaceType::None)]
[ComVisibleAttribute(true)]
public ref class UpdateInstallationInfoCollection : WsusCollection
[<SerializableAttribute>]
[<GuidAttribute("DF2C80AA-B24F-4C3D-B4D4-9A09DDDC1FA0")>]
[<ClassInterfaceAttribute(ClassInterfaceType.None)>]
[<ComVisibleAttribute(true)>]
type UpdateInstallationInfoCollection =
class
inherit WsusCollection
end
<SerializableAttribute>
<GuidAttribute("DF2C80AA-B24F-4C3D-B4D4-9A09DDDC1FA0")>
<ClassInterfaceAttribute(ClassInterfaceType.None)>
<ComVisibleAttribute(True)>
Public Class UpdateInstallationInfoCollection
Inherits WsusCollection
Constructors
Name | Description | |
---|---|---|
UpdateInstallationInfoCollection() | Initializes a new instance of the UpdateInstallationInfoCollection class. |
Properties
Name | Description | |
---|---|---|
Capacity | (Inherited from CollectionBase.) |
|
Count | (Inherited from CollectionBase.) |
|
InnerList | (Inherited from CollectionBase.) |
|
Item[Int32] | Retrieves or sets the member of the collection at the specified index. |
|
List | (Inherited from CollectionBase.) |
Methods
Name | Description | |
---|---|---|
Add(IUpdateInstallationInfo) | Adds installation information to the end of the collection. |
|
Add(Object) | Adds an element to the end of the collection.(Inherited from WsusCollection.) |
|
AddRange(Array) | Adds the elements of the specified array to the end of this collection. (Inherited from WsusCollection.) |
|
AddRange(IUpdateInstallationInfo[]) | Adds an array of installation information to the end of the collection. |
|
AddRange(UpdateInstallationInfoCollection) | Adds the members of an installation information collection to the end of the collection. |
|
AddRange(WsusCollection) | Adds the items in the specified SusCollectionBase to the end of this collection.(Inherited from WsusCollection.) |
|
Clear() | (Inherited from CollectionBase.) |
|
Contains(IUpdateInstallationInfo) | Determines if the collection contains the specified installation information. |
|
Contains(Object) | Determines whether the specified element is in the collection.(Inherited from WsusCollection.) |
|
CopyTo(Array, Int32) | Copies the entire collection of values to a one-dimensional array, starting at the specified index of the target array.(Inherited from WsusCollection.) |
|
CopyTo(IUpdateInstallationInfo[], Int32) | Copies the installation information in the collection to a one-dimensional array. |
|
Equals(Object) | (Inherited from Object.) |
|
Finalize() | (Inherited from Object.) |
|
GetEnumerator() | (Inherited from CollectionBase.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetType() | (Inherited from Object.) |
|
IndexOf(IUpdateInstallationInfo) | Determines if the collection contains the specified installation information. If the collection contains the installation information, the method returns the zero-based index to the installation information in the collection. |
|
IndexOf(Object) | Searches for the specified element and returns the zero-based index of it if it exists.(Inherited from WsusCollection.) |
|
Insert(Int32, IUpdateInstallationInfo) | Inserts installation information into the collection. |
|
Insert(Int32, Object) | Inserts an element into the collection at the specified index.(Inherited from WsusCollection.) |
|
MemberwiseClone() | (Inherited from Object.) |
|
OnClear() | (Inherited from CollectionBase.) |
|
OnClearComplete() | Performs additional custom processes after clearing the contents of the UpdateCollection instance.(Inherited from WsusCollection.) |
|
OnInsert(Int32, Object) | Provides overridden validation functionality which checks that we do not insert duplicates into our collection.(Inherited from WsusCollection.) |
|
OnInsertComplete(Int32, Object) | Performs additional custom processes after inserting a new element into the UpdateCollection instance.(Inherited from WsusCollection.) |
|
OnRemove(Int32, Object) | (Inherited from CollectionBase.) |
|
OnRemoveComplete(Int32, Object) | Performs additional custom processes after removing an element from the UpdateCollection instance.(Inherited from WsusCollection.) |
|
OnSet(Int32, Object, Object) | Provices overridden validation functionality which checks that we do not insert duplicates into our collection.(Inherited from WsusCollection.) |
|
OnSetComplete(Int32, Object, Object) | Performs additional custom processes after setting a value in the UpdateCollection instance.(Inherited from WsusCollection.) |
|
OnValidate(Object) | (Inherited from CollectionBase.) |
|
Remove(IUpdateInstallationInfo) | Removes the installation information from the collection. |
|
Remove(Object) | Removes a specified element from the collection.(Inherited from WsusCollection.) |
|
RemoveAt(Int32) | (Inherited from CollectionBase.) |
|
ToString() | (Inherited from Object.) |
Explicit Interface Implementations
Name | Description | |
---|---|---|
ICollection.CopyTo(Array, Int32) | (Inherited from CollectionBase.) |
|
IList.Add(Object) | (Inherited from CollectionBase.) |
|
IList.Contains(Object) | (Inherited from CollectionBase.) |
|
IList.IndexOf(Object) | (Inherited from CollectionBase.) |
|
IList.Insert(Int32, Object) | (Inherited from CollectionBase.) |
|
IList.Remove(Object) | (Inherited from CollectionBase.) |
|
ICollection.IsSynchronized | (Inherited from CollectionBase.) |
|
ICollection.SyncRoot | (Inherited from CollectionBase.) |
|
IList.IsFixedSize | (Inherited from CollectionBase.) |
|
IList.IsReadOnly | (Inherited from CollectionBase.) |
|
IList.Item[Int32] | (Inherited from CollectionBase.) |
Examples
namespace WsusSamples
{
using System;
using System.Xml;
using Microsoft.UpdateServices.Administration;
class DetermineUpdateStatusForAllComputers
{
static void Main(string[] args)
{
const string usage = "\r\n" +
"ComputerStatusToXml. Creates an XML file with a list computers on the Update Services server, " +
"and the status of updates approved for each computer." +
"\r\n\r\n" +
"USAGE:" +
"\r\n\r\n" +
" ComputerStatusToXml.exe [IncludeDownstreamComputers]" +
"\r\n\r\n" +
" IncludeDownstreamComputers: Include computer targets rolled up from downstream servers." +
"\r\n";
// evaluate args
bool includeDownstreamComputers = false;
if (args.Length >= 1)
{
if (args.Length > 1 || args[0].ToLower() != "includedownstreamcomputers")
{
Console.WriteLine(usage);
return;
}
if (args[0].ToLower() == "includedownstreamcomputers")
{
includeDownstreamComputers = true;
}
}
XmlTextWriter xml = null;
try
{
Console.WriteLine("Getting computer status...");
// open the XML file
string xmlWriterFile = string.Format("{0}{1}{2}{3}",
Environment.CurrentDirectory.ToString(),
"\\ComputerStatus ",
DateTime.Now.ToLongDateString().ToString(),
".xml");
xml = new XmlTextWriter(xmlWriterFile, System.Text.Encoding.UTF8);
xml.Formatting = Formatting.Indented;
xml.Indentation = 4;
xml.WriteStartDocument(true);
xml.WriteStartElement("ComputerStatus");
// Connect to the local WSUS server
IUpdateServer updateServer = AdminProxy.GetUpdateServer();
// Get the collection of computers on this server
ComputerTargetScope computerTargetScope = new ComputerTargetScope();
computerTargetScope.IncludeDownstreamComputerTargets = includeDownstreamComputers;
ComputerTargetCollection computers = updateServer.GetComputerTargets(computerTargetScope);
// loop through the computer collection
foreach (IComputerTarget computer in computers)
{
// start the element for the computer
xml.WriteStartElement("Computer");
xml.WriteAttributeString("Name", computer.FullDomainName);
xml.WriteAttributeString("LastReportedStatus", computer.LastReportedStatusTime.ToString());
if (includeDownstreamComputers == true)
{
string parentName = "LocalHost";
if (computer.ParentServerId != Guid.Empty)
{
parentName = computer.GetParentServer().FullDomainName;
}
xml.WriteAttributeString("ParentServer", parentName);
}
// start the element for the status of updates on this computer
xml.WriteStartElement("UpdateStatus");
// get the install state of all updates approved for this computer
UpdateInstallationInfoCollection installStatus = computer.GetUpdateInstallationInfoPerUpdate();
// loop through the updates in the install info collection and output the
// name of the update and it's install state on this computer
foreach (IUpdateInstallationInfo updateStatus in installStatus)
{
xml.WriteStartElement("Update");
xml.WriteAttributeString("Title", updateStatus.GetUpdate().Title);
xml.WriteAttributeString("Status", updateStatus.UpdateInstallationState.ToString());
// close the Update element
xml.WriteEndElement();
}
// close the UpdateStatus element
xml.WriteEndElement();
// close the Computer element
xml.WriteEndElement();
} // foreach
} //try
catch (Exception)
{
} // catch
finally
{
Console.WriteLine("Done. Results are written to the ComputerStatus {0}.xml file in the current folder",
DateTime.Now.ToLongDateString());
xml.Close();
} // finally
} // main
}
}
Thread Safety
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Microsoft.UpdateServices.Administration Namespace
Return to top