Disk Management and VB.Net

~OSD~ 2,196 Reputation points
2021-01-15T10:21:43.777+00:00

Hi,

Currently I am using Diskpart to make desired disk layout. However, when combining with scripting, I am not getting desired results as diskpart script failed to procced further if a partition is not found etc.

Desired Disk Layout:

If "Q:\" drive exists, this is the desired drive to work with. | Q represents first partition of Disk1 or Disk 2 |

Check if Q belongs to Disk1 IF YES, check if Partition 2 exists on Disk1 , IF YES, Delete this partition and create a new partition and assign drive letter P. ELSE IF Partition2 was not found, simply create a new partition.

If Q:\ belongs to Disk2, same tasks should be carried for Disk2. (there will either Disk1 or Disk2 with drive letter=Q)

Any thoughts if it can be achieved in VB.net? (I am having mix results with standard diskpart / script this is why I asked here in VB Forum).

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,734 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.