VMware vSphere PowerCLI Reference by Alan Renouf & Luc Dekens

VMware vSphere PowerCLI Reference by Alan Renouf & Luc Dekens

Author:Alan Renouf & Luc Dekens
Language: eng
Format: epub
Publisher: Sybex
Published: 2011-03-16T16:00:00+00:00


The script in Listing 12-6 produced a listing like this:

Name Type IScsiHbaName

---- ---- ------------

192.168.111.1:3260 Send iqn.1998-01.com.vmware:esx41-35fe03...

192.168.111.1:3260 Static iqn.1998-01.com.vmware:esx41-35fe03...

Unfortunately, as we worked with this automation, we found a few problems with the Get-IScsiHbaTarget cmdlet in the PowerCLI build we used for this book (VMware vSphere PowerCLI, version 4.1). To bypass these problems and as an example of how you can use the vSphere object properties from your scripts, we provide the Get-IScsiHbaTargets function in Listing 12-7, which emulates the Get-IScsiHbaTarget cmdlet. The function also shows you if the CHAP setting is enabled for each target and if it was inherited from the CHAP settings of the parent.

Listing 12-7: Get-IScsiHbaTargets function

function Get-IScsiHbaTargets{

<#

.SYNOPSIS

Returns the iScsi targets

.DESCRIPTION

The function returns all the iScsi targets of the

requested Type for one or more iScsi HBAs

.PARAMETER IScsiHba

The iScsi HBA(s) for which you want to retrieve the

targets

.PARAMETER Type

The type of iScsi HBA targets you want to retrieve.

The valid values are Send and Static

.NOTES

Source: Automating vSphere Administration

Authors: Luc Dekens, Arnim van Lieshout, Jonathan Medd,

Alan Renouf, Glenn Sizemore.PARAMETER SqlServer

.EXAMPLE

PS> Get-IScsiHbaTargets -IScsiHba $hba -Type Static

.EXAMPLE

PS> Get-VMHost MyESX | &prime;

>> Get-VMHostHba -Type IScsi | &prime;

>> Get-IScsiHbaTargets

#>



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.