VMware Cloud Community
mprobst
Contributor
Contributor
Jump to solution

need help with you cannot call a method on a null-valued expression

I am trying to use  esxcli.storage.core.device.set to attach a lun, but I cannot seem to get powercli to take the command

PowerCLI D:\Scripts\Attach-Datastore> $esxcli.storage.core.device.set()

You cannot call a method on a null-valued expression.

At line:1 char:32

+ $esxcli.storage.core.device.set <<<< ()

    + CategoryInfo          : InvalidOperation: (set:String) [], RuntimeException

    + FullyQualifiedErrorId : InvokeMethodOnNull

I am on powercli version 5.8 release 1 if it matters, my hosts and vcenter are 5.5 u3

Any help would be appreciated

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

It looks as if you didn't initialise $esxcli.

Did you do a Get-EsxCli?

Perhaps you could show us the script you are trying to run


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

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

It looks as if you didn't initialise $esxcli.

Did you do a Get-EsxCli?

Perhaps you could show us the script you are trying to run


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

0 Kudos