var objArgs = WScript.Arguments;

if (objArgs.length == 2)
{
    var ConnectString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Connect Timeout=180;Persist Security Info=False;Initial Catalog=Log_" + objArgs(0) + ";Data Source=.\\ScanMail"

    // ADO definition SchemaEnum
    var adSchemaTables      = 20;
    var adSchemaColumns     = 4;
    //
    var conn = new ActiveXObject("ADODB.Connection");
    conn.Open(ConnectString);


    var rsSchemaTables = conn.OpenSchema(adSchemaTables);

    var rsSchemaColumns = conn.OpenSchema(adSchemaColumns);

    while (!rsSchemaTables.EOF)
    {
        var tblType = rsSchemaTables("TABLE_TYPE");
        var tblName = rsSchemaTables("TABLE_NAME");
        if (rsSchemaTables("TABLE_TYPE") == "TABLE")
        {
		    var strTblName = String(tblName);

		    var rs = conn.execute("[" + strTblName + "]");
		    rs.Save(objArgs(1) + "log_" + strTblName + "_" + objArgs(0) + ".bak", 1);
        }
        rsSchemaTables.MoveNext();
    }
}
