VMware Cloud Community
kluken
Contributor
Contributor
Jump to solution

Setting LVM.EnableResignature issue with PowerCLI in vpshere 5.1 and Powercli 5.1 U2

We use SRM and like to make sure that when done with test that the LVM.EnableResignature is set back to 0 since we do relocate hosts often. I have tried 2 different ways to do this and both fail with "A specified parameter was not correct" All the samples I see online are for esx 4.x and below, I have not seen anyone verify this in 5.x.  We are 5.1U1 and latest powercli.

Any help would be greatly appreciated.

Method 1:

$vh contains the name of the host to be reset:

if ((Get-VMHostAdvancedConfiguration -vmhost $vh -Name LVM.EnableResignature).Values -ne 0){

     Set-VMHostAdvancedConfiguration -vmhost $vh -Name LVM.EnableResignature -Value 0 -Confirm:$false

}

Method 2:

Borrows code from functions I have seen online:

if ((Get-VMHostAdvancedConfiguration -vmhost $vh -Name LVM.EnableResignature).Values -ne 0){

$esx = Get-View (Get-VMHost $vh).ID
$optmgrMoRef = $esx.configManager.advancedOption
$optmgr = Get-View $optmgrMoRef

$optarray = $optmgr.QueryOptions("LVM.Enableresignature")
$optarray[0].Value = 0
$optmgr.UpdateOptions($optarray)

}

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

It looks as if the function from  9.  Re: Set LVM/EnableResignature = 1 with PowerCLI on ESX 4.1

works on 5.1 as well

Function Set-VMHostResignature {

    [CmdletBinding()]

  

    Param (

        [Parameter(

            Mandatory = $True,

            ValueFromPipeline = $True

        )]

        [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl[]]$VMHost,

      

      

        [Parameter(

            Mandatory = $True,

            Position = 0

        )]

        [ValidateSet(0, 1)]

        [long]$Value

  

    )

    Begin {

  

        $Option = New-Object Vmware.Vim.Optionvalue -Property @{

             Key = "LVM.EnableResignature"

             Value = $Value

        }

        $OptionArray = $Option

    }

    Process {

  

        $VMHost | ForEach-Object {

      

            $ESX = Get-View $_.ID

            $OptMgr = Get-View $ESX.ConfigManager.AdvancedOption

            $OptMgr.UpdateOptions($OptionArray)

        }

      

    }

}

Get-VMHost | Set-VMHostResignature -Value 1


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
kluken
Contributor
Contributor
Jump to solution

One thing I notice is when I just dump all the advancedOptions I do not even see LVM.EnableResignature. IIt works via esxcfg, so I wonder why it is not working via PowerCLI

0 Kudos
LucD
Leadership
Leadership
Jump to solution

It looks as if the function from  9.  Re: Set LVM/EnableResignature = 1 with PowerCLI on ESX 4.1

works on 5.1 as well

Function Set-VMHostResignature {

    [CmdletBinding()]

  

    Param (

        [Parameter(

            Mandatory = $True,

            ValueFromPipeline = $True

        )]

        [VMware.VimAutomation.ViCore.Impl.V1.Inventory.VMHostImpl[]]$VMHost,

      

      

        [Parameter(

            Mandatory = $True,

            Position = 0

        )]

        [ValidateSet(0, 1)]

        [long]$Value

  

    )

    Begin {

  

        $Option = New-Object Vmware.Vim.Optionvalue -Property @{

             Key = "LVM.EnableResignature"

             Value = $Value

        }

        $OptionArray = $Option

    }

    Process {

  

        $VMHost | ForEach-Object {

      

            $ESX = Get-View $_.ID

            $OptMgr = Get-View $ESX.ConfigManager.AdvancedOption

            $OptMgr.UpdateOptions($OptionArray)

        }

      

    }

}

Get-VMHost | Set-VMHostResignature -Value 1


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
kluken
Contributor
Contributor
Jump to solution

Yup, I found that and pulled in pieces into my script so mine works now, thanks! Not sure why the striaght forwaed Set-VMHostAdvancedConfiguration  did not work, but at least I have something.

foreach ($vh in $vmhosts) {

if ((Get-VMHostAdvancedConfiguration -vmhost $vh -Name LVM.EnableResignature).Values -ne 0){
  Write-Host Resignature value is enabled for host $vh
        Write-Host Resetting resignature value to disabled
 
     $Option = New-Object Vmware.Vim.Optionvalue -Property @{
             Key = "LVM.EnableResignature"
             Value = $Value
         }

            $OptionArray = $Option

            $ESX = Get-View $vh.ID
            $OptMgr = Get-View $ESX.ConfigManager.AdvancedOption
            $OptMgr.UpdateOptions($OptionArray)
  }
}

0 Kudos