PowerCLI

 View Only
  • 1.  Script to get path policy of all datastores

    Posted Feb 15, 2016 01:12 PM

    Dear all,

    I require a script which checks the path policy of all datastores in a vcenter.

    Also it needs to change the path policy to round robin, if it is not set to round robin already.

    I have written a script for the same. But this requires manual feeding of esxi hosts names and also the script is very slow.

    Please help.

    MYSCRIPT:

    ForEach ($Server in Get-Content ("Servers.txt") )

    {

    Get-VMHost $Server | Get-ScsiLun -LunType "disk" |where {$_.MultipathPolicy -ne "RoundRobin"}|Set-ScsiLun -MultipathPolicy RoundRobin

    Write-output  “Completed on” $Server >> outputresolved.csv

    }



  • 2.  RE: Script to get path policy of all datastores

    Posted Feb 15, 2016 02:27 PM

    Can't you just do this

    Get-VMHost | Get-ScsiLun -LunType "disk" |where {$_.MultipathPolicy -ne "RoundRobin"}| Set-ScsiLun -MultipathPolicy RoundRobin



  • 3.  RE: Script to get path policy of all datastores

    Posted Feb 15, 2016 02:53 PM

    Hi Luc,

    Yes, but this process is slow, when I have lot of datastores.

    Is there a way, instead of piping it via vmhost, can i directly check the datastore ( something via get-datastore ) which may be faster.

    Am not able to find any.