Ogenstad.net

Security Stories and Help with Network Documentation

Once upon a time this used to be my blog. For current updates head over to Networklore.

About / Stories / Contact

  • GitHub
  • LinkedIn
  • RSS
  • Twitter

Powered by Genesis

How to Document Servers with SYDI – Part 3 of 3

October 18, 2006 by patrick.ogenstad 32 Comments

Wasn’t There an Option for Html?

I might have said there was at some time, but it was a white lie. What you can do is to convert the XML file into a Html document. It’s quite easy and it’s used in this way:

cscript.exe sydi-transform.vbs -xServer.xml -sServerhtml.xsl -oServer.html

Running this script will require that Server.xml and Serverhtml.xsl and sydi-html-stylex.xsl are located in the same directory. If you have created private xsl files you can use the sydi-transform to convert it.

Hey, Wasn’t This about Documentation?

It sure was, most of what we’ve looked at up until now has been more geared against Inventory instead of Network Documentation. I saved the best for last, a new tool in sydi-server 2.0 is the ss-xml2word.vbs script (or SYDI-Server XML to Word).

What the script does is that it takes an XML file and converts it to a Word document. You might be thinking that SYDI already wrote to Word, which is true, however there are situations where that isn’t possible. For example in environments where you don’t have Word installed, may it be in a DMZ or as a scheduled task on a server.

The good part though is the options you specify when creating the Word document. To view these options run:

cscript.exe ss-xml2word.vbs -h

Here you can see that there are two arguments that are required -x and -l.

cscript.exe ss-xml2word.vbs -xServer1.xml -llang_english.xml

This line will create a Word document based on the information in the Server1.xml file, it will then use the English language file which describes what it writes to the Word document. This means that you can have the documentation in your native language. When I released SYDI-Server 2.0 there was support for English and Swedish. Later people have contributed with there own language files which you can download; Italian, Norwegian, Portuguese and Dutch.

One issue that causes the ss-xml2word.vbs script to fail for many people is a path problem. If you run the script and it just writes out a few pages without any information from the xml file and the script crashes, this is happening to you. Either put all the files in the same directory or specify the path after -x -l or -s. I will fix this in future versions so the error message is a bit more user-friendly.

The most exciting feature as I see it is the optional -s argument. This is the reason I created SYDI in the first place. The -s option specifies an XML file which contains the written documentation about the server. That is the documentation you have created, this differs from the data that SYDI-Server has gathered from the machine.

Let’s take it for a spin.

Writing Your Documentation

To get you started I’ve included three files in the Examples directory (of sydi-server), copy the howto.xml and rename it to Server1_docs.xml. This will be where you will write the documentation. Open the Server1_docs.xml file in Notepad. Scrolling up and down you will see different XML tags. You’ll recognize the sections and subsections from the Word documents previously created.

Inside the sections and subsections you will se prenotes and postnotes, inside these there are a few tags. The only thing you have to do in this file is to create and edit tags. Scroll down to the section called toc (Tables of Contents), here you will se the difference between prenotes and postnotes. It has to do where they appear in the final document. Just run a few tests and you’ll se what I mean. So let’s start to document.

In the system info section change this:
In this version you are only able to use text tags, more could be availible in later versions of SYDI.To:

Physical Location: Server Room in Stockholm
System Owner: BOFH
Support Agreement: 3Y Next Business Day (Expires 2007-10-16)
Save the file and create the final document.

cscript.exe ss-xml2word.vbs -xServer1.xml -llang_english.xml -sServer1_docs.xml

The above was just an example, you are of course free to write and include whatever you want in the documentation. If you fail to create the documents it’s good to know that XML parsers are very unforgiving if there’s an error in any of the files. Make sure all tags are closed correctly by opening them in a browser. If you fail to open Server1_docs.xml in a browser the problem is there. Fix it and try again.

I’ve also created a batch file, writedoc.cmd which looks like this:
cscript tools\ss-xml2word.vbs -x\\serverr\net$\sydi\output\%1.xml -llanguage\lang_english.xml -s\\server\itsupport$\documentation-source\%1-written.xml -o\\server\itsupport$\documentation-binder\Server-%1.doc -d -b”Table Contemporary”

I use it by running
Writedoc.cmd Servername

So there you have it, that’s how I use SYDI-Server. If you have any questions just post a comment or contact me.

Read Part 1
Read Part 2

[tags]network documentation, server documentation, sydi, how to, tutorial[/tags]

Filed Under: SYDI

Comments

  1. JB says

    August 1, 2007 at 3:40 am

    Dude.

    the ss-XML2word.vbs seems to have an issue with Work 2007. works fine in 2003 but returns a “SS-XML2Word.vbs(1249, 3) Microsoft runtime error: Type Mismatch: ‘oWord.Selection.TypeText’. I’ll have a quick look into it but it does work with other versions of word.

    -JB.

  2. PA says

    July 13, 2009 at 6:16 pm

    This is great, however I have issue with C:\Users\Perrpetual\Downloads\sydi-server-2.3>cscript.exe ss-xml2word.vbs-xServer1.xml -llang_english.xml

    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.

    Input Error: There is no script engine for file extension “.xml”.

    Could you please tell me what I am doing wrong? Everything works well upto this point. I need to get it work before I try it on multiple computers.

    Thanks and great job done.

  3. Patrick says

    August 12, 2009 at 8:19 pm

    PA You have to have a space between ss-xml2word.vbs and -xServer1.xml.

  4. Chee Lam says

    September 8, 2009 at 9:02 pm

    Hi Patrick,

    Thanks for the application.
    I am blogging it and soon will link back to you.

    Q: Instead of do it one at a time, how can I automate writedoc.cmd to process all the xml files within the output folder?

    Thanks.
    Chee

  5. Patrick says

    September 10, 2009 at 2:35 pm

    Chee Currently I haven’t written a script which lets you do that. But I might include one in future versions of SYDI-Server.

  6. Timo says

    December 15, 2009 at 12:43 pm

    PA create a batch file copy and paste the following:
    ————————————————————————————-
    @ECHO off
    @set Pfad=%~d0\PortableApps\sydi-server-2.3\

    @For /F %%i in (‘dir /S /B %Pfad%Rechner\*.xml’) do (
    cscript.exe “%Pfad%\tools\ss-xml2word.vbs” -l”%Pfad%\language\lang_german.xml” -o”%%~di%%~pi%%~ni.doc” -x”%%~fi” -d
    )
    —————————————————————————————
    edit the Pfad , my output xml file are in the subdirectoy Rechner so change it too.

  7. Durai says

    March 23, 2010 at 11:30 pm

    Thanks for your script and it is working perfectly in our environment..

    I need a small help form you,How can i add further inputs to excel file which getting input from XML file

    For example :
    Your script show system processor speed and i need processor name too added in the output what should i do?

    Hope this clears

  8. Chris Buck says

    November 17, 2010 at 5:50 am

    Note for people using Timo’s script – it works perfectly but when I copied and pasted it, I had to replace all the single and double quote marks before it would work for me – replace “ with ” and ‘ with ‘ – hope this helps – Chris

  9. cheryl says

    November 17, 2010 at 6:59 pm

    I am running this on 2 servers and it hangs at start subroutine: gatherWMIinformation (server name)

    any ideas?

  10. Patrick Ogenstad says

    November 20, 2010 at 11:03 am

    Cheryl: Can you run the script locally on the servers? What happens if you use the -D option?

  11. Rogue73k says

    March 17, 2011 at 7:51 am

    Thanks, Patrick.These scripts have been a very powerful tool in my quiver for some time. I predominatly support small business’ and my client cant afford the luxurey of (nor do they need…) sophiticated documentation and change management. With these scripts, I can gather what I need or have one of my techs work the site, and have the knowledge to get it done right and effectivily.
    Any good suggestions for further learning articles related to techniques to manipulate the plethora of output? I usually copy and paste in Excel using VLOOKUPs and concatenation, but that has proved difficult with server counts over 4,000, and the need to report on various parts of the data in different ways.

    Thanks,
    Rogue73k

  12. Pieter says

    October 10, 2011 at 9:57 am

    Hi Patrick,

    Just to say: many thanks!!
    Works perfect, looks great, easy to use,…

    Thanks.

    Pieter

  13. Kong Jin Jie says

    October 18, 2011 at 3:49 am

    I don’t normally comment in any blogs but I think your script is worth commenting.

    I want to thank you for taking the effort to write such a wonderful script to assist many network administrators in documentation (which is last thing we want to do).

    Keep it up and never let this project die off!

    Cheers!

  14. Marius says

    March 28, 2012 at 1:36 pm

    Great tool. How do I add a picture to the footer? Tx!

  15. MrV says

    April 17, 2012 at 11:53 am

    What a great tool! About the HTML conversion: is it possible to convert bunch of xml files by one command or batch file? That would be really helpful.

  16. Jon says

    June 19, 2012 at 2:42 pm

    MrV – I was just trying to figure out the same thing and ended up with the following batch script – it’s not clean, but it works… see below:

    for /f “usebackq delims=|” %%f in (`dir /b “z:\output”`) do cscript.exe sydi-transform.vbs -x”..\output\%%f” -s”..\output\serverhtml.xsl” -o”..\HTML\%%f.html”

    Notes:
    All XML Files are in Z:\Output
    The required Serverhtml.xsl and sydi-html-stylex.xsl are in Z:\Output
    I created a directory “HTML” in the root of my sydi-server installation

  17. Jon says

    September 5, 2012 at 11:58 pm

    For those interested – I incorporated the above post into a batch file that can be run as a scheduled task to gather up to date information via a scheduled task, and generate HTML files as part of the process.

    All you need to do is ensure that sydi-wrapper OUTPUTDIRECTORY is pointing to a directory called “output” in the root of your sydi installation, and that you’ve created a directory called HTML in the root of your sydi installation.

    Put this batch file in the root of your sydi installation, and modify the AD container configuration on line 3.

    Patrick – Thank you for putting your time and effort into making this script!

    Download it here (Dropbox via goo.gl url shortner): http://goo.gl/M35F9

  18. Gabriel says

    September 11, 2013 at 8:42 pm

    Patrick, thanks for this awesome tool. Keep up the good work.

  19. Mark E says

    October 17, 2013 at 4:27 pm

    I don’t often post praise, but these scripts are an absolute god send!
    Thanks Patrick for all your time and effort on these. Really can’t give enough thanks….several companies think I worked my little heart out to document their estate….haha!!
    Keep up the astounding work.

  20. Manos PETRIDIS says

    August 28, 2015 at 3:29 pm

    First of all, many heartfelt thanks for providing the scripts!

    Secondly, I’ve tried sending you a Greek translation template for sydi-server xml files, but failed (report follows). Is there some other way to submit such files?

    kind regards,
    Manos PETRIDIS

    mail failure report highlights:
    support@pulsion.co.uk: Your message couldn’t be delivered to the mailbox because you don’t have permission to send to it. Ask the mailbox’s email admin to remove you from the reject list, then try again.
    For more information, see DSN 5.7.130 Errors in Exchange Online and Office 365.

    ‘550 5.7.130 RESOLVER.RST.NotAuthorizedRejectMessageFromForMailbox; not authorized to send to this mailbox because the mailbox is set up to reject mail from certain senders’

    protection.outlook.com: volo.com does not designate permitted sender hosts

  21. Walter van Wijk says

    August 31, 2015 at 9:52 am

    I’m getting this error when I want to generate an Excel file.
    —–
    Opening Excel File
    Writing Basic Computer Information
    d:\sydi\tools\sydi-overview.vbs(596, 2) Microsoft VBScript runtime error: Subscript out of range
    —–

    It looks like that the problem is with opening a new tab in Excel

  22. Walter van Wijk says

    August 31, 2015 at 10:25 am

    Problem Solved. I needed to add the followings lines :

    Line 596 :
    objExcel.Sheets.Add ,objExcel.Sheets(1) ‘ Add a new sheet after the last one

    Line 598 :
    objExcel.Sheets.Add ,objExcel.Sheets(2) ‘ Add a new sheet after the last one

  23. Jörg Wiesemann says

    September 22, 2015 at 3:51 pm

    There is a problem in the script sydi-audit-localgroups.vbs when you use it with Excel 2013
    You got following error:

    Opening Excel File
    G:\IT\Sydi\server\tools\sydi-audit-localgroups.vbs(270, 4) Microsoft VBScript runtime error: Subscript out of range

    And this is because Excel now only open one sheet instead of three
    So you have to change row 269 that look like this
    If (intSheet < 4) Then

    To following
    If (intSheet < 2) Then

    When you have done this it works

  24. Karim says

    February 4, 2016 at 8:31 am

    Hi

    can anyone help with this error, thanks in advance.

    I’ve copied the whole folder to D:\ and my xml output file is also in D:\

    Input Error: Can not find script file “D:\sydi-server-2.4\ss-xml2word.vbs”.

  25. Karim says

    February 4, 2016 at 8:58 am

    please ignore my first message. now I’m getting this message;

    2) Microsoft Word: The requested member of the collection does not exist.

    Word open empty and my xml file is working fine

  26. Judy says

    February 22, 2016 at 3:21 pm

    Similar to JON – I have used a FOR loop to product WORD documents:
    for /F %i in (c:\pathtoServersTextFile) do cscript.exe sydi-server.vbs -wabefghipPqrsSu -rc -f10 -t%i -uUSERID -pPASSWORD -oc:\SYDI\%i.doc

  27. Brian Black says

    March 3, 2016 at 5:56 pm

    Anyone know if when you capture data using the AD connection using SYDI-Wrapper.vbs. Is there an easy way to convert all of the xml files into html using a single command or script?

  28. Marty Gomez says

    November 1, 2016 at 10:17 pm

    $1 = gci C:\scripts\VB\sydi-server-2.4\Out\*.xml

    Clear-host
    $ErrorActionPreference = ‘SilentlyContinue’

    foreach ($file in $1){

    $3 = $file.Name

    $split = $3.split(‘.’)[0].split(‘ ‘)

    cscript “C:\scripts\VB\sydi-server-2.4\tools\sydi-transform.vbs” -x”$file” -sC:\scripts\VB\sydi-server-2.4\xml\serverhtml.xsl -oC:\scripts\VB\sydi-server-2.4\Out\htm\$split.html

    }

  29. Mr AP says

    December 2, 2016 at 8:18 pm

    Hi Guys

    Anyone have this issue when running Sydi-overview

    sydi-overview.vbs(593, 5) Microsoft Excel: Unable to set the FreezePanes property of the Window class

  30. Cam Bart says

    January 31, 2017 at 6:24 am

    Hey Mr AP – I overcame this issue if you ensure that your excel is not launching minimized. Open and expand your excel after it is launched from SYDI. Maximise / full screen your excel window, save & close the file. On next launch of sydi-overview.vbs that creates excel file it will launch full window and capable of using the FreezePanes. Just make sure lines 590 to 603 in sydi-overview now look like:

    objExcel.Cells.Select
    objExcel.Cells.EntireColumn.AutoFit
    objExcel.ActiveWindow.SplitRow = 0.8
    objExcel.ActiveWindow.FreezePanes = True
    objExcel.Range(“A1”).Select
    objExcel.Sheets(1).Name = “Computers”
    objExcel.Sheets.Add ,objExcel.Sheets(1) ‘ Add a new sheet after the last one
    objExcel.Sheets(2).Name = “WMI Programs”
    objExcel.Sheets.Add ,objExcel.Sheets(2) ‘ Add a new sheet after the last one
    objExcel.Sheets(3).Name = “Registry Programs”
    objExcel.Sheets.Add ,objExcel.Sheets(3) ‘ Add a new sheet after the last one
    objExcel.Sheets(4).Name = “Processes”
    objExcel.Sheets.Add ,objExcel.Sheets(4) ‘ Add a new sheet after the last one
    objExcel.Sheets(5).Name = “OS Distribution Data”

  31. ETT says

    June 18, 2018 at 12:32 pm

    Hello, I run the script and get XML file, when I tried to open in Browser I could not read it is in XML tag,
    how I can read this file and converted to DOC

  32. Doug says

    October 19, 2018 at 1:47 am

    Good work, thanks for putting this stuff up.

Leave a Reply Cancel reply

You must be logged in to post a comment.