Sample Download: http://code.msdn.microsoft.com/CppVDSUninstallDisks-7192ea26
This sample demonstrates how to use VDS to uninstall disks and volumes. Warning: uninstalling a disk may lead to potential data loss. Use this sample with care.
This sample takes the disk number performs a complete uninstall, including the dismount of the volume and uninstall underlying disks. To use this sample you will need to provide the disk number for input. This can be found by right clicking on my computer choosing manage, once the Manage UI is open choose Disk Management and look for the TEST disk that you wish to uninstall. The number associated with this TEST disk will be the input parameter. After you run the sample this TEST disk should disappear from Disk Management. If you are not using VHD's for this test you will need to reboot your system for the disk to be recognized by Disk Management.
For detailed introduction of the sample, please read the documentation at http://code.msdn.microsoft.com/CppVDSUninstallDisks-7192ea26
You can find more code samples that demonstrate the most typical programming scenarios by using Microsoft All-In-One Code Framework Sample Browser or Sample Browser Visual Studio extension. They give you the flexibility to search samples, download samples on demand, manage the downloaded samples in a centralized place, and automatically be notified about sample updates. If it is the first time that you hear about Microsoft All-In-One Code Framework, please watch the introduction video on Microsoft Showcase, or read the introduction on our homepage http://1code.codeplex.com/.