HOWTO: Mount disks on new Windows VMs using Powershell

When adding new disks to Windows VMs using CloudBolt, the disks are not automatically mounted as accessible drives.  Some users want to mount those disks to particular drive letters, but others just want them available as any drive letter that's available.

The following Powershell script will iterate through the available disks that are not mounted in Windows and assign them to the next available drive letter.  This script can be used as a CloudBolt Orchestration Action, under the "Provision Server" process.  It is typically placed in the last hook point, "Post-Provision".

get-disk | Where-Object PartitionStyle -Eq "GPT" | New-Partition -AssignDriveLetter -UseMaximumSize | Format-Volume -confirm:$false

This script can be modified if you have specific tasks you'd like to perform for the disks, but should get you started with mounting disks in Windows.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.