HewlettPackard / POSH-HPEOneView

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

Get-OVServerProfileTemplate | ConvertTo-OVPowerShellScript: DirectoryGroups and ManageIloSettings are not being added correctly #587

Closed AtomP4FX closed 1 year ago

AtomP4FX commented 2 years ago

Expected Behavior

Getting Server Profile Template information, converting it to PowerShell commands and reimporting it by using the automatically generated PowerShell code. Using following command to generate the PowerShell code:

Get-OVServerProfileTemplate -name $name | ConvertTo-OVPowerShellScript | Out-File $path

Actual Behavior

PowerShell Code for converting the Server Profile Templates into scripts works fine but you are not able to use the generated code to reimport the Server Profile Template because DirectoryGroups and ManageIloSettings parameters are not set correctly. Here are the examples of two sections in the code, I will show only the differences. For the whole code and profile in JSON I will contact separately.

1. # ------------------- iLO Settings Policy

Generated

$iloSettings = New-OVServerProfileIloPolicy ....  -DirectoryGroups $mpLocalAccounts -ManageIloHostname $mpHostName

> $mpLocalAccounts - no such variable at all

How it should be

$iloSettings = New-OVServerProfileIloPolicy .... -ManageDirectoryGroups -DirectoryGroups $mpGroups -ManageIloHostname -IloHostname $mpHostName

2. # -------------- Attributes for advanced settings

Generated

New-OVServerProfileTemplate .... -ManageIloSettings

How it should be

New-OVServerProfileTemplate .... -ManageIloSettings $True

Steps to reproduce

  1. Generate manually a simple Server Profile Template with at least one Directory Group and iLO settings modifications.
  2. Run "Get-OVServerProfileTemplate | ConvertTo-OVPowerShellScript" to generate PowerShell code for this Server Profile Template
  3. Try to reimport the Server Profile Template by using the automatically generated PowerShell code
  4. You will get an error that will state missing/invalid arguments.
  5. Workaround: manually add correct variables and parameters into the automatically generated code will make the code runable.

Example execution with error message:

New-OVServerProfileIloPolicy : Cannot validate argument on parameter 'DirectoryGroups'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At line:88 char:292
+ ... s $mpDirectoryServerAddress -DirectoryGroups $mpLocalAccounts -Manage ...
+                                                  ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [New-OVServerProfileIloPolicy], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,New-OVServerProfileIloPolicy

New-OVServerProfileTemplate : Missing an argument for parameter 'ManageIloSettings'. Specify a parameter of type
'System.Boolean' and try again.
At line:90 char:510
+ ...  -BiosConsistencyChe
```cking $biosConsistency -ManageIloSettings -IloSet ...
+                                                ~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-OVServerProfileTemplate], ParameterBindingException
    + FullyQualifiedErrorId : MissingArgument,New-OVServerProfileTemplate

Version Information

HPE OneView PowerShell Library Version (Get-HPOVVersion or $PSLibraryVersion):

PS C:\WINDOWS\system32> Get-HPOVVersion

192.168.111.128                     LibraryVersion Path
---------------                     -------------- ----
ApplianceVersion: 6.30.00.447630.00 6.30.2928.3678 C:\Program Files\WindowsPowerShell\Modules\HPEOneView.630\6.30.2928.3678

HPE OneView Appliance Version (Get-HPOVVersion -ApplianceVer):

OneView 6.30. Tested at OneView, Synergy OV, OV DCS, Synergy DCS. BL gen10, DL gen10, Synergy gen10.

Output from $PSVersionTable on your Windows Host:

Name                           Value
----                           -----
PSVersion                      5.1.18362.1801
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.1801
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
ChrisLynchHPE commented 2 years ago

This is fixed in Release 6.30.3188.1900 and in PowerShell Gallery.

Please verify before this issue is closed.

ChrisLynchHPE commented 1 year ago

Closing due to no further activity. If you wish, feel free to re-open to discuss further.