tags:

views:

140

answers:

1

I can drop a SqlServer Backup Device using SQL-DMO using the following pseudo-code:

SQLDMO.SQLServer2 server = New SQLDMO.SQLServer2();
server.Connect("myserver");
server.BackupDevices.Remove("mybackupdevice");
File.Delete(mybackupdevicephysicallocation);

SMO.Server.BackupDevices does not appear to have a Remove() method, so how can I drop a BackupDevice using SMO?

I'm hoping that I've just missed something obvious.

+2  A: 

Use BackupDevice.Drop:

Server server = new Server("localhost");
BackupDevice device = server.BackupDevices["devicename"];
device.Drop();
Remus Rusanu
@remus-rusanu: Thanks much! I'm embarrassed at how easy that is.
C-Pound Guru