Got this question today that a customer was looking for a provisioning script that allowed them to create several hundred volumes with assigned prefixes and then add them to a Protection Group to help them scale out a deployment.
The below script helps with that workflow and provides a basis for other feature additions.
Inputs
- FlashArray IP/Name
- Credentials, this can be automated using a previous blog post here.
- Customer prefix, eg. XYZCorp
- Volume size (GB)
- # of volumes to create
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
$FlashArray = Read–Host ‘FlashArray IP/Name’ $EndPoint = New–PfaArray –EndPoint $FlashArray –Credentials (Get–Credential) –IgnoreCertificateError $CustomerPrefix = Read–Host ‘Customer Prefix’ $VolumeSize = Read–Host ‘Volume Size (GB)’ $NumberOfVolumes = Read–Host ‘Number of Volumes to create’ $Volumes = @() for($i = 1; $i –le $NumberOfVolumes; $i++){ New–PfaVolume –Array $EndPoint –VolumeName “$CustomerPrefix-Vol$i” –Unit G –Size $VolumeSize $Volumes += “$CustomerPrefix-Vol$i” } $Volumes –join “,” $AssigntoCustomerPGroup = Read–Host “Assign to $CustomerPrefix-PGroup (Y/N)” if ($AssigntoCustomerPGroup.ToUpper() –eq ‘Y’) { New–PfaProtectionGroup –Array $EndPoint –Name “$CustomerPrefix-PGroup” –Volumes $Volumes } else { Write–Warning ‘No Protection Group created.’ } |
Hope this is useful!
Thanks,
Barkz