VMware Cloud Community
iamshivaji
Contributor
Contributor

Disable few paths from ESXi hosts which part of one Cluster

Hi,

We are doing a storage port re-balancing and as part of that i want to disable FEW storage paths from each ESXi from ONE ESXi host cluster as the storage team assigned new storage paths to the same set of LUN's. I could see all new paths now. Storage team want to pull back the old paths. I want to disable the old paths from a set of ESX Hosts(part of same cluster) before storage team pull back the paths.

I have 60 paths for each HBA and 2 HBA's for each ESXi host  which makes a total of 120 paths. Storage team gave the storage path information which i have to disable and i could see them on each HBA.

I tried doing it from powercli script but for some reason it is not working.

We are using ESXi 5 Update 3.

Is there an easy way to do this without manually disabling 120 times for ESXi host?

-Shivaji

11 Replies
LucD
Leadership
Leadership

Would you mind sharing the script you used, and the eventual messages it produced ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
iamshivaji
Contributor
Contributor

LucD,

I dont get any output.

$tgtHBA = "vmhba2"

$tgtPortWWN = "5764617912562315608"

Get-VMHost | Get-ScsiLun -LunType disk | where {$_.RuntimeName.Contains($tgtHBA)} |Get-ScsiLunPath | where

{$_.Extensiondata.Transport.PortWorldWideName -eq $tgtPortWWN} |Set-ScsiLunPath -Active:$false

Here is the link i followed. This was updated by you in 2011 🙂

Re: Disabling paths to migrate all FC storage connections to specified port on HBA

-Gurram

0 Kudos
LucD
Leadership
Leadership

From where are you running that script ? From the PowerCLI prompt ?

Any error messages ?

Which vSphere and PowerCLI version are you using ?

Just ran that script, and it seems to work without a hitch for me.

The script should output something like this (the State property is the one to watch for)

LUN-Path.png


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

iamshivaji
Contributor
Contributor

Ok. Good.

I have PowerCLI 5.1 release 1 and ESXi 5.0.0, 1311175

Can you please share me the exact script.

-Gurram

0 Kudos
iamshivaji
Contributor
Contributor

I am running the script from vCenter server.

-Gurram

0 Kudos
iamshivaji
Contributor
Contributor

i am using powerCLI from vCenter server. I dont see any tasks getting created and no output in the prompt. Attached the screenshot and the script.

Power CLI screenshot.jpg

-Gurram

0 Kudos
LucD
Leadership
Leadership

Ok, I think I know what happens.

You placed that script in a PS1 file, correct ?

You seem to call the PS1 file from the PowerCLI prompt, but it looks as if you typed "<dot><blank>\disable_paths.ps1".

Is that correct ?

If the PS1 file is stored in the folder where you are located (C:\Scripts\PowerCLI\Shivaji), then you should type

.\disable_paths.ps1

at the PowerCLI prompt. No blank between the dot and the back-slash.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
iamshivaji
Contributor
Contributor

yes it is a PS1 file but there is no blank in between dot and back-slash.

-Gurram

0 Kudos
LucD
Leadership
Leadership

Is your PowerShell execution poicy set correctly ? Do a

Get-ExecutionPolicy

Are you connected to a vSphere server ? Do a

$global:DefaultVIServer


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
iamshivaji
Contributor
Contributor

Get-ExecutionPolicy shows unrestricted


$global:DefaultVIServer shows my vCenterServer.

0 Kudos
LucD
Leadership
Leadership

Then I'm afraid I'm at the end of my ideas.

The only thing I could suggest, try to execute the lines in the PS1 file, one by one directly from the PowerCLI prompt.

Curious to see if that works.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos