Hi,
I wrote a few lines for you that should do the job.
However I didn't get the chance to test it so I warmly recommend you to do a few tests on unused luns to check that it works as expected.
You can makes tests by editing the get-vmhost to run it on one only, and the get-scsilun to run it on one lun by adding a "where canonicalname -eq ******".
Before running any script (in general) especially when storage is involved you need to make sure it can't go nuts.
$queuefullsamplesize =
$queuefullthreshold =
$Vendor = #Vendor of your array (If you want to update all the lun on arrays of this vendor)
Get-VMHost | ForEach-Object {
$esxcli = get-esxcli -VMHost $_ -V2
$arguments = $esxcli.storage.core.device.set.CreateArgs()
$arguments.queuefullsamplesize = $queuefullsamplesize
$arguments.queuefullthreshold = $queuefullthreshold
($_ | Get-ScsiLun -LunType disk | where vendor -eq $Vendor).CanonicalName | ForEach-Object {
$arguments.device = $_
$esxcli.storage.core.device.set.Invoke($arguments)
}
}
I also wrote a couple useful function that I use all the time to convert Datastores to Lun names.
It's in my modules, you're welcome to steal it :smileyhappy:
Function Convert-DSToCanonical {
param(
[Parameter(Mandatory = $True,ValueFromPipeline=$True)]
[VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl[]]
$datastore
)
Process {
$datastore | ForEach-Object {
$CanonicalName = (Get-View $_).Info.Vmfs.Extent.diskname
$CanonicalName
}
}
}
Function Convert-CanonicalToDS {
param(
[string]$canonicalname
)
get-datastore * | ForEach-Object {
IF ((Convert-DSToCanonical -datastore $_ | select -Unique) -eq $canonicalname){
$_
}
}
}