sComputer = "SWYNKSRV01" '-- name of the computer where SQL Server is installed sSQLServer = "SWYNKSRV01" '-- name of the SQL server instance containing the database which log is to be truncated sDb = "Northwind" '-- name of the database which log is to be truncated Set oInstance = GetObject("winmgmts:{impersonationLevel=impersonate}//" & _ sComputer & "/root/MicrosoftSQLServer:MSSQL_TransactionLog.SQLServerName=" & _ Chr(34) & sSQLServer & Chr(34) & ",Name=" & Chr(34) & sDb & Chr(34)) Set oOutParam = oInstance.Truncate() If oOutParam.ReturnValue = 0 Then WScript.Echo "Transaction log of the database " & sDbName & " truncated successfully" Else WScript.Echo "Truncating transaction log of the database " & sDb & " failed with the error " & oOutParam.Description End If