I was hoping for a little help here. Ive written a script that Should set a lun to "Perennially Reserved" using Powercli & Get-ESXICli, however when I run the following command locally on a host to confirm this worked and luns are tagged respectively, i find that the output is False
esxli storage core device list | grep reserved
The script ive written is below. Im aware their are easier ways to obtain the identifiers and get host names, etc. However im more concerned about the actual action of the script in setting the reservation.
Param( $RootCredentials = (Get-Credential) ) $RDMDisks = ("naa.60002ac0000000000000003e00002b3e","naa.60002ac0000000000000002800002b3e","naa.60002ac0000000000000003f00002b3e","naa.60002ac0000000000000002b00002b3e","naa.60002ac0000000000000002d00002b3e","naa.60002ac0000000000000002f00002b3e","naa.60002ac0000000000000003100002b3e","naa.60002ac0000000000000003500002b3e","naa.60002ac0000000000000003600002b3e","naa.60002ac0000000000000003700002b3e","naa.60002ac0000000000000003800002b3e","naa.60002ac0000000000000003900002b3e","naa.60002ac0000000000000004100002b3e","naa.60002ac0000000000000003b00002b3e","naa.60002ac0000000000000002600002b3e","naa.60002ac0000000000000002700002b3e","naa.60002ac0000000000000002900002b3e","naa.60002ac0000000000000002a00002b3e","naa.60002ac0000000000000002c00002b3e","naa.60002ac0000000000000002e00002b3e","naa.60002ac0000000000000003000002b3e","naa.60002ac0000000000000003300002b3e","naa.60002ac0000000000000004000002b3e","naa.60002ac0000000000000003c00002b3e","naa.60002ac0000000000000003200002b3e","naa.60002ac0000000000000003400002b3e") $TargetHosts = ("Server190","Server191","Server192","Server193","Server194","Server195","Server196") Foreach ($ESXHost in $TargetHosts) { Connect-VIServer $ESXHost -Credential $RootCredentials } Start-Sleep -Seconds 3 Foreach($esxcli in Get-ESXCli) { Foreach ($ESXHost in $TargetHosts){ Foreach ($Disk in $RDMDisks) { $esxcli.storage.core.device.setconfig($false, $Disk, $true) } } } Foreach ($ESXHost in $TargetHosts) { Disconnect-VIServer $ESXHost -Confirm:$false |Out-Null }
Thanks in advance for any help.