VMware Cloud Community
UofS
Enthusiast
Enthusiast

Error when trying to enable iscsi

I have been trying for a while to enable iscsi via powershell script.

What seems to work for everyone else including autolab doesnt work for me.  I see reference to a problem back in 2009/2010 but nothing recent.

Please explain why this code:

$VMHost = "blade01.domain.com"

Connect-VIServer $VMHost

Get-VMHostStorage $VMHost | Set-VMHostStorage -SoftwareIScsiEnabled $true

The error I always get is:

Get-VMHostStorage : 5/26/2014 11:36:38 AM    Get-VMHostStorage        Object re

ference not set to an instance of an object.

At C:\Users\...\Documents\ps-scripts\vc55upgrade\createMgtBlades.ps1:91 char

:35

+ $VMHostStorage = Get-VMHostStorage <<<<  -VMHost $VMhostObj | Set-VMHostStora

ge -SoftwareIScsiEnabled $True

    + CategoryInfo          : NotSpecified: (:) [Get-VMHostStorage], VimExcept

   ion

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomatio

   n.ViCore.Cmdlets.Commands.Host.GetVMHostStorage

I have tried several variations on this to no avail.

Get-VMHostStorage returns the error by iself


$value = Get-VMHostStorage $VMHost


ends up having $value= null

Thoughts anyone?

I am connecting directly to the esxi 5.5 and not via vcenter.

/dion

0 Kudos
2 Replies
LucD
Leadership
Leadership

Does the old fix, see Re: Get-VMHostStorage issue with PowerCLI 4.1 and ESXi 4.1,  still work ?


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

0 Kudos
UofS
Enthusiast
Enthusiast

Yes that old workaround apparently is still the way it needs to be done.  Thought that would have been resolved 2+ years later.  Thanks again.

0 Kudos