How can I make the 'rept.vbs' reporting script replace the database file instead of adding another d (NETIQKB42247)

  • 7742247
  • 02-Feb-2007
  • 19-Jun-2007

Resolution

goal
How can I make the 'rept.vbs' reporting script replace the database file instead of adding another database file to the reporting directory?

fact
Directory and Resource Administrator 6.x

fact
Directory and Resource Administrator 7.0

fact
Directory and Resource Administrator 7.0 SP1

fact
Directory and Resource Administrator 7.5

fix

The Rept.vbs script is a Microsoft Visual Basic Script that is available from the Knowledge Depot for Directory and Resource Administrator (DRA).  This script, when run from the command line, performs an import and generates a report in HTML format for each of the available DRA reports.  By default, this script makes a backup of the current Microsoft Access database (mdb) and adds this backup file to the default C:\Program Files\NetIQ\DRA\Reporting folder and appends the name of the database with the date.  This script can be accessed at this link:

 

 

Import reports and publish to the Web

 

The Rept.vbs script can be modified to prevent this backup copy from being generated and added to the Reporting folder.  Please follow these steps to make this modification:

  1. Open the file Rept.vbs with Notepad or an editor of your choice.
  2. To keep any particular line from processing in VBS, the line can be commented so that the line is interpreted as a comment instead of a command.  Search the script for the following section:
    ' Determine the name of the copy of the backend database

    NewName = Right(CStr(Year(Date)),2)
    Mnth = Month(Date)
    If Mnth < 10 Then
    NewName = NewName & "0" & Cstr(Mnth)
    Else
    NewName = NewName & Cstr(Mnth)
    End If
    Da = Day(Date)
    If Da < 10 Then
    NewName = NewName & "0" & Cstr(Da)
    Else
    NewName = NewName & Cstr(Da)
    End If
    NewName = NewName & ".mdb"

    'WScript.Echo NewName
    Set fso = WScript.CreateObject("Scripting.FileSystemObject")

    ' The name of the backend database will need to be changed in
    '  the next statement.  The text between "-" and "." should
    '  match the NetBios name of the DRA server.

    'f1 = Folder & "\OaRept-CHANORN01.mdb"
    f1 = Folder & "\OaRept-dynamic7.mdb"

    'Wscript.Echo "f1 = " & f1
    f2 = Folder & "\" & NewName
    'WScript.Echo "f2 = " & f2
    oShell.LogEvent 4, "DRA Import Copying " & f1 & " to " & f2
    Err.Clear
    fso.CopyFile f1, f2, True
    If Err.Number <> 0 Then
    oShell.LogEvent 1, _
    "DRA Import Error after attempting to copy the backend database: " _
    & Cstr(Err.Number) & " Description: " & Err.Description
    Exit Sub
    End If
    oShell.LogEvent 4, "DRA Import copy completed."
  3. Add a comment (such as the apostrophe character) to the beginning of each line for this section so that it now looks like this:
    ' Determine the name of the copy of the backend database

    ? NewName = Right(CStr(Year(Date)),2)
    ? Mnth = Month(Date)
    ? If Mnth < 10 Then
    ?    NewName = NewName & "0" & Cstr(Mnth)
    ? Else
    ?    NewName = NewName & Cstr(Mnth)
    ? End If
    ? Da = Day(Date)
    ? If Da < 10 Then
    ?    NewName = NewName & "0" & Cstr(Da)
    ? Else
    ?    NewName = NewName & Cstr(Da)
    ? End If
    ? NewName = NewName & ".mdb"
    ?
    ?   'WScript.Echo NewName
    ?   Set fso = WScript.CreateObject("Scripting.FileSystemObject")
    ?
    ?   ' The name of the backend database will need to be changed in
    ?   '  the next statement.  The text between "-" and "." should
    ?   '  match the NetBi.
    os name of the DRA server.
    ?
    ?   'f1 = Folder & "\OaRept-CHANORN01.mdb"
    ?   f1 = Folder & "\OaRept-dynamic7.mdb"
    ?  
    ?    'Wscript.Echo "f1 = " & f1
    ?  f2 = Folder & "\" & NewName
    ?  'WScript.Echo "f2 = " & f2
    ?  oShell.LogEvent 4, "DRA Import Copying " & f1 & " to " & f2
    ?  Err.Clear
    ?  fso.CopyFile f1, f2, True
    ?  If Err.Number <> 0 Then
    ?    oShell.LogEvent 1, _
    ?       "DRA Import Error after attempting to copy the backend database: " _
    ?       & Cstr(Err.Number) & " Description: " & Err.Description
    ?    Exit Sub
    ? End If
    ? oShell.LogEvent 4, "DRA Import copy completed."
    • After making this change and saving the changes, this script will no longer make a backup copy of the database.  You can schedule or run this script as normal.  

    .


    Additional Information

    Formerly known as NETIQKB42247