How to delete Volume Shadow Copies using C#?

752 Views Asked by At

I need to delete one or all shadow copies in Windows Server 2003. How I can do it using C#? For example, I can write "vssadmin delete shadows /all" in cmd and all will be fine, but me need to do it automatically.

1

There are 1 best solutions below

0
Vamshi Gujju On

Add "/quiet" to the end of your vssadmin command. This will suppress the user prompt and allow you to delete shadow copies with C#:

Ex. vssadmin delete shadows /all /quiet

You can also specify a particular shadow copy:

Ex. vssadmin delete shadows /Shadow={b2708a51-9bdc-4db0-b80a-008ba8e4689f} /quiet