Is there any reason (and any way round it) that the get-scsilun call seems to be so expensive?
I'm enumerating through all the datastores on a server, and I'm doing a call to get all the scsiluns for a canonicalname. Each call to get-scsilun is taking 22 seconds to complete - and with 79 datastores on each server, it's taking almost 30 mins per server to run through the script (and therefore 3 hours to complete on our cluster of 6 machines).
Is there any way to speed up this call?
I'm currently using
$scsilun = get-scsilun -vmhost $objvmhost -canonicalname $lun
where $objvmhost is returned from $objvmhost = get-vmost vmserver01.local. I initially tried it passing the vmhost name as text, and letting the toolkit deal with it. Changing to passing the object made no difference in the speed.
My psuedo code for what I'm trying to do is...
get-datastores on host
for each datastore
{
get the first extent of the datastore
for each lun in the first extent
{
get-scsilun <- This is the slow part
get-scsilunpath for the lun
display active path -or- set active path to the lunpath we want
}
}
Is there a better way to loop through all the datastores and display/set the active paths?
Graham