Mount disk and also create mount points RRS feed

  • Question

  • Hi All.

    I have a VM with a raw disk allocated to it. However I want to create a function which would create a drive and also mount point folders.

    Get-Disk | Where partitionstyle -eq ‘raw’ |Initialize-Disk -PartitionStyle MBR -PassThru | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel “disk2” -Confirm:$false

    The above creates a new volume & drive from the existing raw disk. 

    This is what I want however.

    Have a function take a parameter which is the root drive i.e E:

    Then after E: is created, a mount point folder structure is created.

    E:\    1GB

    E:\data01    10GB

    E:\log01    10GB

    E:\backup01     10GB

    If I then run the function again, I can either provide a root folder i.e F is the next letter to use or it can automatically determine F: to be the next letter.

    F:\    1GB

    F:\data02    10GB

    F:\log02     10GB

    F:\backup02     10GB

    Thanks in advance.

    Monday, March 18, 2019 11:01 PM

All replies