Using HPE OneView Powershell Module to Create Volumes for VMware and Attach to Server Profile

I've been spending a lot of time in HPE Synergy OneView lately while building out my VMware Environment. OneView is a awesome tool, especially when your storage and blades can be managed from one console. Getting storage presented to VMware from OneView is a easy process but very time consuming. Especially when there are around 18 Templates to work with. After some digging I found a powershell module HPE released for OneView. Let me save you some time on this. Instead of having one module for OneView and updating it, HPE has a module for each version of OneView. this is because the API changes per version. To find your version log into your OneView console, click the OneView drop down at the top left then settings. the top left you will see appliance info as shown below;

As you can see my appliance is on version 4.20, here is a link to the powershell gallery. https://www.powershellgallery.com/packages/HPOneView.420/4.20.2290.1501

This can be installed directly from powershell. Install-module HPOneView.420

Let get into the script;

First we will need to connect powershell to the OneView appliance and to the vCenter where the datastore will be created.

The next part of the script will ask the questions to get all the data needed to create the variables we need to get the work done. the first command Get-HPOVStoragePool will list all the storage available and how much in each pool is used.

Once all the data has been input we are ready to create the LUN

I created a foreach loop to add the new LUN to all the server profiles in a cluster. Be sure to change line 21 in the script to reflect your blades in the cluster of your choosing.

That's it for now, this script is still a work in progress. When I get a chance I will be adding the Datastore creation in vmware to the script. Along with a rescan for all host in the cluster. Here is a link to the github site if you would like to download a copy of the script.

https://github.com/shanermoore/scripts/blob/master/OVVolumeBuild.ps1

Stay Tuned....