Comparing WSUS Computers to Known List

Discussion in 'Update Services' started by Tim McGue, Sep 8, 2005.

  1. Tim McGue

    Tim McGue Guest

    I am looking to compare the list of computers within WSUS to a list of known
    computers I have. The intention of this would be to ensure no computers are
    missed. Obviously I can manually compare WSUS to my list, but I would rather
    do it programmatically (vbscript preferred).

    Thanks,
    Tim McGue
     
    Tim McGue, Sep 8, 2005
    #1
    1. Advertisements

  2. You might want to grab the WSUS SDK from the WSUS website.

    Unfortunately, the current incarnation of the WSUS SDK only supports
    development in VS .NET, though I suspect you can write the code in notepad
    and compile it with the vbc.exe compiler available in the .NET Framework
    v1.1 SDK (which is also installed on every system with the .NET Framework
    v1.1 installed).

    See %windir%\Microsoft.NET\Framework\v1.1.4322\vbc.exe for details.
     
    Lawrence Garvin, Sep 9, 2005
    #2
    1. Advertisements

  3. Tim McGue

    RodeCa Guest

    RodeCa, Sep 10, 2005
    #3
  4. it's pretty straightforward to get a list of computers using the API. Here's
    a quick snippet that would dump all the the computers to a CSV file. What
    you do with it then is your own business <g>

    The easist way to build this is to take one of the samples pointed to in the
    URL below & replace the code in Main().



    Imports Microsoft.UpdateServices.Administration
    Module Module1

    Sub Main()

    Dim proxy As New AdminProxy
    Dim Server As IUpdateServer
    Dim CSVFile As System.IO.StreamWriter

    Try
    'connect to the server
    Server = proxy.GetUpdateServer

    'open the CSV file
    CSVFile = New
    System.IO.StreamWriter(Environment.CurrentDirectory & "\WSUSComputerList-" &
    DateTime.Now.ToLongDateString & ".csv")

    'write the 1st line of the CSV file
    CSVFile.WriteLine("Computer Name, Target Group, IP Address,
    Last Sync Time")

    For Each c As IComputerTarget In Server.GetComputerTargets

    CSVFile.WriteLine("{0},{1},{2},{3}", _
    c.FullDomainName, _
    c.GetComputerTargetGroup.Name, _
    c.IPAddress.ToString, _
    c.LastSyncTime.ToString)
    Next

    CSVFile.Close()
    Console.WriteLine("Done. Results are written to the " &
    Environment.CurrentDirectory & "\WSUSComputerList-" &
    DateTime.Now.ToLongDateString & ".csv file in the current folder")

    Catch ex As Exception
    Console.WriteLine("An error occured:" & vbCrLf & ex.ToString)
    If CSVFile Is Nothing = False Then
    CSVFile.Close()
    End If
    End
    End Try
    End Sub

    End Module
     
    Craig Marl [MSFT], Sep 12, 2005
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.