Skip to content

Instantly share code, notes, and snippets.

@erikbuild
Created January 4, 2012 15:20
Show Gist options
  • Select an option

  • Save erikbuild/1560502 to your computer and use it in GitHub Desktop.

Select an option

Save erikbuild/1560502 to your computer and use it in GitHub Desktop.
VMware / PowerCLI 5 trying to play with iSCSI settings on a ESXi 5 Host
# Launch PowerCLI and login when prompted
Connect-VIServer myserver.com
# PowerCLI now shows "connected to myserver.com as root" at top.
Get-VMHostStorage
# Get-VMHostStorage : 1/4/2012 10:18:20 AM Get-VMHostStorage Object reference not set to an instance of an object.
# At line:1 char:18
# + Get-VMHostStorage <<<<
# + CategoryInfo : NotSpecified: (:) [Get-VMHostStorage], VimException
# + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVMHostStorage
# Prompt for the ESXi host
$hostname = Read-Host "Enter the ESXi hostname"
# Connect to the server (user will see a popup for credentials)
$server = Connect-VIServer $hostname
# Get the VMHost
$myHost = Get-VMHost $server
# Enable Software iSCSI on the host.
Get-VMHostStorage $myHost
# Disconnect cleanly
Disconnect-VIServer -Confirm:$false
# Same error message as above.
Get-VMHostStorage -VMHost myserver.com
# Same error message :(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment