Hello
I have a Problem with set HA Restart Priority from a csv file on VMs.
My script part is like that:
if ($Export)
{
# Export to csv
$mycluster = Get-Cluster -Name $Cluster
$mycluster.ExtensionData.Configuration.DasVmConfig |
Select @{N="VM";E={Get-View $_.Key -Property Name | Select -ExpandProperty Name}},
@{N="RestartPriority";E={$_.RestartPriority}} |
Export-Csv $Path\HARestartPrio.csv -NoTypeInformation -UseCulture }
if ($Set)
{
# Set from csv
$Import = Import-Csv $Path\HARestartPrio.csv
foreach ($line in $Import)
{ set-vm -vm $line."VM" -HARestartPriority $line."RestartPriority" -Confirm:$false } }
When I will set the priority, the CLI give an error back:
The HARestartPriority Parameter can not check. The Argument is Null or empty
What is wrong in my script? Have you any ideas?