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:
PowerShell Code for reimporting the Server Profile Templates works fine but you are not able to use the generated code to reimporting the Server Profile Template due the parameter $netName is missing in the generated code. Example automatically generated code snippet:
Line "$ThisNetwork = Get-OVNetwork -Type Ethernet -Name $netName" will not work and will produce an error because parameter "$netName" is empty (and is not filled anywehere in the automatically generated code).
Steps to reproduce
1) generate manually a simple Server Profile Template with at least one managed connection
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 that the parameter "$netName" is empty
5) optional: by manually add a code line like '$netname = "testnetwork"' into the automatically generated code will make the code runable.
Example execution with error message:
PS C:\Users\ccar\desktop\export_import_OV_settings\export> # -------------- Attributes for ServerProfileTemplate "test"
$name = "test"
$description = "13e213"
$spdescription = "34324125"
$shtName = "SY 480 Gen10 3"
$sht = Get-OVServerHardwareType -Name $shtName
$egName = "EG-Synergy-Local"
$eg = Get-OVEnclosureGroup -Name $egName
$affinity = "Bay"
# -------------- Connections section
$cnConsistency = "Minimum"
# -------------- Attributes for connection "1"
$connID = 1
$connName = "wer324"
$connType = "Ethernet"
$ThisNetwork = Get-OVNetwork -Type Ethernet -Name $netName
$portID = "Mezz 3:1-b"
$requestedMbps = 2500
$Conn1 = New-OVServerProfileConnection -ConnectionID $connID -Name $connName -ConnectionType $connType -Network $ThisNetwork -PortId $portID -RequestedBW $requestedMbps
$connections = $Conn1
# -------------- Attributes for Boot Mode settings
$manageboot = $True
$biosBootMode = "UEFIOptimized"
# -------------- Attributes for boot order settings
$bootOrder = "HardDisk"
$bmConsistency = "Exact"
# -------------- Attributes for BIOS settings
$biosSettings = @(
@{id = 'MinProcIdlePower'; value = 'NoCStates'},
@{id = 'WorkloadProfile'; value = 'Virtualization-MaxPerformance'},
@{id = 'IntelUpiPowerManagement'; value = 'Disabled'},
@{id = 'MinProcIdlePkgState'; value = 'NoState'},
@{id = 'EnergyPerfBias'; value = 'MaxPerf'},
@{id = 'UncoreFreqScaling'; value = 'Maximum'},
@{id = 'PowerRegulator'; value = 'StaticHighPerf'},
@{id = 'SubNumaClustering'; value = 'Enabled'},
@{id = 'CollabPowerControl'; value = 'Disabled'},
@{id = 'PostDiscoveryMode'; value = 'ForceFastDiscovery'},
@{id = 'EnergyEfficientTurbo'; value = 'Disabled'},
@{id = 'NumaGroupSizeOpt'; value = 'Clustered'}
)
$biosConsistency = "Exact"
# -------------- Attributes for advanced settings
New-OVServerProfileTemplate -Name $name -Description $description -ServerProfileDescription $spdescription -ServerHardwareType $sht -EnclosureGroup $eg -Affinity $affinity -ManageConnections $True -ConnectionsConsistencyChecking $cnConsistency -Connections $connections -ManageBoot:$manageboot -BootMode $biosBootMode -BootOrder $bootOrder -BootModeConsistencyChecking $bmConsistency -Bios -BiosSettings $biosSettings -BiosConsistencyChecking $biosConsistency -HideUnusedFlexNics $true
Get-OVNetwork : Cannot validate argument on parameter 'Name'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At line:16 char:74
+ ... = Get-OVNetwork -Type Ethernet -Name $netName
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-OVNetwork], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Get-OVNetwork
New-OVServerProfileConnection : Cannot validate argument on parameter 'Network'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At line:19 char:142
+ ... ame $connName -ConnectionType $connType -Network $ThisNetwork -PortId ...
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [New-OVServerProfileConnection], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,New-OVServerProfileConnection
New-OVServerProfileTemplate : Cannot validate argument on parameter 'Connections'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At line:44 char:260
+ ... ConsistencyChecking $cnConsistency -Connections $connections -Manage ...
+ ~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [New-OVServerProfileTemplate], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,New-OVServerProfileTemplate
Version Information
HPE OneView PowerShell Library Version (Get-HPOVVersion or $PSLibraryVersion):
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:
Actual Behavior
PowerShell Code for reimporting the Server Profile Templates works fine but you are not able to use the generated code to reimporting the Server Profile Template due the parameter $netName is missing in the generated code. Example automatically generated code snippet:
Line "$ThisNetwork = Get-OVNetwork -Type Ethernet -Name $netName" will not work and will produce an error because parameter "$netName" is empty (and is not filled anywehere in the automatically generated code).
Steps to reproduce
1) generate manually a simple Server Profile Template with at least one managed connection 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 that the parameter "$netName" is empty 5) optional: by manually add a code line like '$netname = "testnetwork"' into the automatically generated code will make the code runable.
Example execution with error message:
Version Information
HPE OneView PowerShell Library Version (
Get-HPOVVersion
or$PSLibraryVersion
):HPE OneView Appliance Version (
Get-HPOVVersion -ApplianceVer
):see above. Both appliance are running OneView 5.40
Output from
$PSVersionTable
on your Windows Host: