HPE OneView
Showing results for 
Search instead for 
Did you mean: 

Powershell create profile from template

Rick Drake
Occasional Contributor

Powershell create profile from template

So not quite following the logic on the powershell wiki.  Is there actually a way to create a profile from a server template?  Assumed it was copy profile but that didn't work, or I did it wrong.  Google fu is failing me when attempting to find a script.  Any suggestions?  I am on Oneview 3.1 and using PS module 300.

Dave Olker

Re: Powershell create profile from template

First, if you are using OneView 3.1 then you should be using the 3.1 version of the PowerShell library found here:


Secondly, if you look at the WIKI for the 3.1 version of the New-HPOVServerProfile cmdlet found here:


you will see several examples of how to use this call.  Example #2 on that page shows how to create a Server Profile by providing an existing template:

 -------------------------- EXAMPLE 2 --------------------------

PS C:\> $spt = Get-HPOVServerProfileTemplate -Name 'Hypervisor Cluster Node Template v1'

PS C:\> Get-HPOVServer -Name "Encl1, Bay 1" | New-HPOVServerProfile -name "Hyp-Clus-01" -ServerProfileTemplate $spt | Wait-HPOVTaskComplete

Hope this helps,


Neighborhood Moderator

Re: Powershell create profile from template

As I am the developer and maintainer of the PowerShell library, I wanted to make 1 slight correction:

You can use a lower Major.Minor versioned library with a newer appliance.  So, using the 3.00 PowerShell library will work with a 3.10 appliance.  Please know that I will only support N-2 HPE OneView appliance to PowerShell library versions, which will follows the appliance supported API versions.

Occasional Advisor

Re: Powershell create profile from template

 Dave/Chris - I'm in a similar boat, hoping someone can help... This is a brand new OneView install (and I'm new to OV as well). I'm using OneView 4.10.01 and the 4.10 PowerShell LIbrary. Two functions don't seem to be working as expected. I've created a Server Profile Template "ACDC DL-360 Gen10", and I've added a Server Hardware with Name "ILOMXQ8340076". But when I try to create a new Server Profile for it, using the Example info in the original document and in Dave's comment above, I use this modified commandline: 

$spt = Get-HPOVServerProfileTemplate -Name 'ACDC DL-360 Gen10'
Get-HPOVServer -Name "ILOMXQ8340076" | New-HPOVServerProfile -name "DL360-.136" -ServerProfileTemplate $spt | Wait-HPOVTaskComplete

But I get prompted to input an AssignmentType. From what I read, the correct response here is "server", however as soon as I do that, I get the following error message: 

PS C:\Users\Michael> $spt = Get-HPOVServerProfileTemplate -Name 'ACDC DL-360 Gen10'
PS C:\Users\Michael> Get-HPOVServer -Name "ILOMXQ8340076" | New-HPOVServerProfile -name "DL360-.136" -ServerProfileTemplate $spt | Wait-HPOVTaskComplete

cmdlet New-HPOVServerProfile at command pipeline position 2
Supply values for the following parameters:
AssignmentType: server
New-HPOVServerProfile : A Server resource object or name must be provided when using the "Server" AssignmentType parameter.
At line:1 char:40
+ ... Q8340076" | New-HPOVServerProfile -name "DL360-.136" -ServerProfileTe ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (Server:String) [New-HPOVServerProfile], ServerProfileTemplateResourceException
    + FullyQualifiedErrorId : NullServerNotAllowed,New-HPOVServerProfile

I'm not sure what's missing, as I'm following the example fairly closely. 

I tried a second route, imported a second server, and created a Server Profile manually through the HPOV GUI. I then tried to use the Copy-HPOVServer Profile function as follows: 

PS C:\Users\Michael> Copy-HPOVServerProfile -SourceName "DL360-.134" -DestinationName "DL360-.136" -assign "ILOMXQ8340076"
Copy-HPOVServerProfile : The Target Server Hardware Type does not match the source Profile Server Hardware Type. Please specify a different Server Hardware Device to
At line:1 char:1
+ Copy-HPOVServerProfile -SourceName "DL360-.134" -DestinationName "DL3 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Copy-HPOVProfile:String) [Copy-HPOVServerProfile], ServerProfileResourceException
    + FullyQualifiedErrorId : ServerHardwareTypeMismatch,Copy-HPOVServerProfile

 As you can see, it's pretty simple logic, but for some reason it tells me the Hardware Type is different. This isn't the case, all the servers are identical, and are showing up in OneView that way: 

PS C:\Users\Michael> get-hpovserver

Name          ServerName Status Power Serial Number Model       ROM                    iLO       Server Profile License
----          ---------- ------ ----- ------------- -----       ---                    ---       -------------- -------
ILOMXQ8340076            OK     Off   MXQ8340076    DL360 Gen10 U32 v1.36 (02/14/2018) iLO5 1.35 No Profile     OneViewNoiLO
ILOMXQ834007B            OK     Off   MXQ834007B    DL360 Gen10 U32 v1.42 (06/20/2018) iLO5 1.35 DL360-.134     OneViewNoiLO
ILOMXQ834007F            OK     Off   MXQ834007F    DL360 Gen10 U32 v1.36 (02/14/2018) iLO5 1.35 No Profile     OneViewNoiLO

Any ideas? Are these bugs? Documentation errors? Any alternative ideas for me?



Neighborhood Moderator

Re: Powershell create profile from template

The first issue you reported is a bug, where logic checking for -Server parameter, is flawed.  To get past it, you should omit Pipeline operation at this time, and supply -Server and -AssignmentType during execution of New-HPOVServerProfile.

Occasional Advisor

Re: Powershell create profile from template

Thanks Chris! I was able to make it all work on one line as you suggested:

New-HPOVServerProfile -name "DL360-.133" -ServerProfileTemplate "ACDC DL-360 Gen10" -Server "ILOMXQ834007J" -AssignmentType "server"

I created a .PS1 batch file and it is adding the servers now. 

Any idea why the Copy-HPOVServerProfile command didn't work?

Thanks again,