Option Explicit On Error Resume Next Dim oServer, oDatabase, strInstance, strDatabaseName, strTSQL, WshNetwork, strDefault Set WshNetwork = WScript.CreateObject("WScript.Network") strDefault = WshNetwork.ComputerName&"\RE7_MSDE" strInstance = InputBox("Enter your SQL instance name, RE7_MSDE is listed by default",,strDefault) strDatabaseName = InputBox("Enter your database name") Set oServer = CreateObject("SQLDMO.SQLServer") oServer.LoginSecure = True oServer.Connect strInstance strTSQL = "delete from LOCKCONNECTIONS where CONNECTIONID is not null" Set oDatabase = oServer.Databases(strDatabaseName) oDatabase.ExecuteImmediate(strTSQL) If Err.Number <> 0 Then Err.Clear On Error Goto 0 Wscript.Echo "Unable to remove Locked Connections. Please verify SQL Server instance and database name." Wscript.Quit End If MsgBox "Locked Connections have been removed." oServer.DisConnect Set oServer = Nothing set oDatabase = Nothing set WshNetwork = Nothing