thnx
> Is there a way that we can export the list of all computes from
> our WSUS Admin console to a csv file or any file?
>
Hi,
See some of the examples (e.g. ComputerStatusToXML) in "Windows Server
Update Services API Samples and Tools" available for download here:
http://www.microsoft.com/windowsserversystem/updateservices/downloads/default.mspx
It have some examples on creating reports in HTML, CSV and XML format.
More about the WSUS API here as well:
Platform SDK: Windows Server Update Services
http://msdn.microsoft.com/library/en-us/wus/wus/portal.asp
--
torgeir, Microsoft MVP Scripting, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx
"Torgeir Bakken (MVP)" <Torgeir.B...@hydro.com> wrote in message
news:%23smIj8K...@TK2MSFTNGP11.phx.gbl...
Elplz
> Torgeir,
> I have run the ComputerStartusToXML and it created a big file now how to I
> make it readable as it is a XML Code?
>
Hi,
Lets try something else:
Below is the source code for a VB.Net /console/ program that exports
to a CSV file computer name, OS version and SP version (as found in
the WSUS console). WinXP will be listed as 5.1 (Win2k=5.0, Win2k3=5.2)
You can easily create this command line utility yourself (source code
and build command line supplied below). WSUS expose .NET API's that can
be called from VB.NET, C#.NET, or other .NET languages.
The easiest way to develop .NET programs is to use Visual Studio, but VS is
not required. The .NET Framework ships with all the basic tools necessary
for building .NET programs.
To create the tool just using the builtin tools, do the following on
the WSUS server:
1) Copy the code between the two ----------------8<-----------------
below and save it to a text file named "ExportComputerInfo.vb"
2) Open a command prompt, and and in the command prompt navigate to the
directory containing ExportComputerInfo.vb.
3) Run the following command line (all one one line, you will need to
unwrap the line before running it!):
%WINDIR%\Microsoft.NET\Framework\v1.1.4322\vbc.exe
ExportComputerInfo.vb /r:"%PROGRAMFILES%\Update Services\
service\bin\Microsoft.UpdateServices.Administration.dll"
/out:ExportComputerInfo.exe
This will create a tool called ExportComputerInfo.exe that when run on
the WSUS server will export to a CSV file computer name, OS version
and SP version (as found in the WSUS console).
WinXP will be listed as 5.1 (Win2k=5.0, Win2k3=5.2)
(Note if you use Visual Studio to compile the code instead of using
the command line above, you need to add a reference to the file
microsoft.updateservices.administration.dll in your project, see
bottom of this Web page for more on this:
http://download.microsoft.com/download/7/4/5/7458e392-11de-4543-936c-b5248e344487/readme.htm
)
Content of ExportComputerInfo.vb:
'--------------------8<----------------------
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 _
& "\WSUSComputerInfo-" & DateTime.Now.ToLongDateString & ".csv")
'write the 1st line of the CSV file
CSVFile.WriteLine("""Computer Name"",""OS"",""SP Level""")
For Each c As IComputerTarget In Server.GetComputerTargets
CSVFile.WriteLine("""{0}"",""{1}"",""{2}""", _
c.FullDomainName, _
c.OSInfo.Version.Major.ToString & "." _
& c.OSInfo.Version.Minor.ToString, _
c.OSInfo.Version.ServicePackMajor.ToString)
Next
CSVFile.Close()
Console.WriteLine("Done. Results are written to the " & _
Environment.CurrentDirectory & "\WSUSComputerInfo-" & _
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
'--------------------8<----------------------