Quantcast
Channel: VMware Communities : Document List - vSphere PowerCLI
Viewing all articles
Browse latest Browse all 379

Job-Rescan-ALL-HBA

$
0
0

This program will rescan all the HBA's in your vm enviroment, and instead of doing it one at a time, it creates a seperate job for each ESX host. Thus multithreading the rescan. For ESX 3.5 this is really handy, for vsphere 4 you can have it do a rescan of all HBA's through the vi interface. But this will work against vsphere as well.

 

I developed this script as I needed a quick way to rescan the HBA's when a failover of our HP EVA occurs. And I need the servers to rescan. I'll be working on another version which will suspend the vm's on a particular LUN, failover that particular LUN, rescan and then restart the vm.. As you can imagine this will be tricky and others have written it for other storage systems but not for HP EVA's. 

 

 

 

#Rescan all HBA's creating 1 job for each ESX server


# Kyle Weir, jkw117@gmail.com, 10-05-09

#connects initially to get the list of ESX servers 



Connect-VIServer  "vcenter" -User Administrator -Password password 



vm=get-vmhost



#Passes the server names individually to different jobs. Thus allowing it to ask each ESX host to rescan itself. 



for ($x=0 ; $x -le $vm.length; $x++)
{
Start-Job -ArgumentList $vm[$x|http://communities.vmware.com/community-document-picker.jspa?communityID=3077&subject=%24x].name -ScriptBlock {
Add-PSSnapin VMware.VimAutomation.Core
Connect-VIServer  "vcenter" -User Administrator -Password $pasd
get-vmhost $args| Get-VMHostStorage -RescanAllHBA -rescanVMFS -refresh
} 
} 

 

 

 

Any questions please email me, I am sure this can be updated to eliminate 

 

 


Viewing all articles
Browse latest Browse all 379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>