HewlettPackard / POSH-HPEOneView

PowerShell language bindings library for HPE OneView.
http://hewlettpackard.github.io/POSH-HPEOneView/
125 stars 52 forks source link

New-HPOVServerProfile #308

Closed varunlenkala closed 6 years ago

varunlenkala commented 6 years ago

Please fill in as much information as possible to help resolve your issue.

Expected Behavior

Need to create server profiles from Server profile templates.

Actual Behavior

throwing following error, not sure what I missed.

New-HPOVServerProfile : Parameter set cannot be resolved using the specified named parameters.
At U:\PowerCLI\VIPscripts\SY Scripts.rev2.2\160SYCreateServerProfile.ps1:26 char:53
+ ... B, bay 9" | New-HPOVServerProfile -Name ESX000PBVMW152_DCBR9C1B_B09 - ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-HPOVServerProfile], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,New-HPOVServerProfile

Steps to reproduce

#$SPT = Get-HPOVServerProfileTemplate -Name "SY480Gen91"
$SHT = Get-HPOVServerHardwareType -name "SY 480 Gen9 1"
Get-HPOVServer -Name "BC12000, bay 9" | New-HPOVServerProfile -Name ESX9 -Firmware $false  -AssignmentType Bay -EnclosureGroup IFS_VMWARE_ESX_EG -Sht $SHT -ServerProfileTemplate $SPT - | Wait-HPOVTaskComplete

Version Information

HPOneview.300, HPOneview.310


# Output from $PSVersionTable
`Name                           Value                                                                                                                                                                 
----                           -----                                                                                                                                                                 
PSVersion                      5.1.14393.1944                                                                                                                                                        
PSEdition                      Desktop                                                                                                                                                               
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                               
BuildVersion                   10.0.14393.1944                                                                                                                                                       
CLRVersion                     4.0.30319.42000                                                                                                                                                       
WSManStackVersion              3.0                                                                                                                                                                   
PSRemotingProtocolVersion      2.3                                                                                                                                                                   
SerializationVersion           1.1.0.1    
ChrisLynchHPE commented 6 years ago

That's because you are including parameters that would assign the profile to an empty server device bay, and your intent is to assign to a specific server hardware resource. Your call should have been:

$SPT = Get-HPOVServerProfileTemplate -Name "SY480Gen91" -ErrorAction Stop
Get-HPOVServer -Name "BC12000, bay 9" -ErrorAction Stop | New-HPOVServerProfile -Name ESX9 -Firmware:$false -Sht $SHT -ServerProfileTemplate $SPT | Wait-HPOVTaskComplete
varunlenkala commented 6 years ago

Thanks Chris for quick response. There seems to be a problem with my ISE, it works fine in my regular console.

ChrisLynchHPE commented 6 years ago

Closing this issue.