windows scripting with RS

  • Does anyone know if it is possible to use windows scripting with RS without writing lots of custom data extensions?

    I have one data extension that reads the error logs but it strikes me that the WMI scripts that you could write to get disk info from your servers and whether they need defraged are quite simple but implementing the six interfaces you need for a custom data extension is not.

    So if any of you know anything about this it would be much appreciated.

    Dave

  • This was removed by the editor as SPAM

  • I thought i would reply to my own request since I have solved it.

    Its dead easy just write a few windows scripts get them to put the info into the database and report from the table you shoved the data into. Simple.

    My boss is now dead happy that he can view all the disk info a man or lady could ever want form his server

    Dave

  • Hi David,

    I was watching this thread because I too was thinking of writing a windows script to help with deployment. I'm new to C# and was wondering if you could post any of your source for us to view even if it's not in C#.

    Thanks,

    Greg

  • I'm not actually writing scripts for deployment but so that I can extract management information from the servers and display them as reports.

    One of the most popular examples is writing a custom data extension that allows you to create reports from your windows event logs on different servers but this involves writing six different interfaces and the taking the dll you built and copying it into the appropriate folder on the report server and then finally editing the config files to register the custom extension which seems to be rather laborious to me.

    The same can be achieved by writing a windows script to load the data into a table on your server and then just reporting from that. So to do the above I would create table thus:

    CREATE TABLE [dbo].[EventTable] (

    [Logfile] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [Category] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [ComputerName] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [EventCode] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [Message] [varchar] (4000) COLLATE Latin1_General_CI_AS NULL ,

    [RecordNumber] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [SourceName] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [TimeWritten] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [Type] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,

    [User] [varchar] (50) COLLATE Latin1_General_CI_AS NULL

    ) ON [PRIMARY]

    GO

    create a dsn called events logs and the just schedule the follwing vb script on the servers in question. The select from specifies the name of the table in the database where the data will be written.

    strComputer = "."

    Set objConn = CreateObject("ADODB.Connection")

    Set objRS = CreateObject("ADODB.Recordset")

    objConn.Open "DSN=EventLogs;"

    objRS.CursorLocation = 3

    objRS.Open "SELECT * FROM EventTable" , objConn, 3, 3

    Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colRetrievedEvents = objWMIService.ExecQuery _

    ("Select * from Win32_NTLogEvent")

    For Each objEvent in colRetrievedEvents

    objRS.AddNew

    objRS("Logfile") = objEvent.Logfile

    objRS("Category") = objEvent.Category

    objRS("ComputerName") = objEvent.ComputerName

    objRS("EventCode") = objEvent.EventCode

    objRS("Message") = objEvent.Message

    objRS("RecordNumber") = objEvent.RecordNumber

    objRS("SourceName") = objEvent.SourceName

    objRS("TimeWritten") = objEvent.TimeWritten

    objRS("Type") = objEvent.Type

    objRS("User") = objEvent.User

    objRS.Update

    Next

    objRS.Close

    objConn.Close

    This obviously extracts the event logs off the local machine but it can be modified to iterate around all your servers in your active directory.

    There's a whole load of these scripts in the script center on technet and you just need to modify them so that they output data to the database instead of the screen.

    I have done the same for applications installed on client machines and disk information. You can write this C# but this is much quicker to write plus there lots of free ready written ones to modify to your hearts content.

    Regards

    David

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply