Servers - General

Need help with ssacli and PowerCLI

Occasional Visitor

Need help with ssacli and PowerCLI

I'm trying to build a tool that can validate the wear stats on Solid State disks using the VMware.PowerCLI module for Powershell.  For reference, I'm currently working with PowerCLI Version:  VMware PowerCLI 11.0.0 build 10380590

I'm trying to figure out how to modify scripts to use get-esxcli v2 and I just am not getting how to convert these to v2.  I'll show some examples of what I was able to pull previously, and if anyone has some insight I would appreciate the help translating these.

First thing first, I'll define the variables, so for the old school (I know it wasn't called V1, but the first version of get-esxcli):

$esxcli = get-esxcli -vmhost <esxihostname>

Then to show all controllers I would do the following:
$esxcli.ssacli.cmd("ctrl all show status")

lets say this then revealed I had two controllers 1) E208i-a in Slot 0 and 2) E208i-p in Slot 1.  I could get details on the controllers with:

$esxcli.ssacli.cmd("ctrl all show detail")

If I wanted to get the physical disks on a specific controller I could do something like:

$esxcli.ssacli.cmd("ctrl slot=0 pd all show status")

And then to show details (lots and lots of details) on a specific disk on that array controller I would do the following:

$esxcli.ssacli.cmd("ctrl slot=0 pd 1I:3:2 show detail")

Some of the details you can get out of this are obviously the size, type, exposed to OS, speed of the disk, firmware, Serial Number, if it is a Solid State disk, its estimated life based on workload to date...  


At our organization we were receving OneView alerts similar to the following:

Solid state disk wear status is now 131072 for drive at location Physical Volume Port: 4I Box: 0 Bay: 10 connected to controller in Smart Array B140i RAID in Slot 0. BD-L4-C2, bay 13

Resolution If the SSD wear status is 'ssdWearOut(6)', replace the drive.


So I had developed a tool to quickly go out and grab the wear stats on that disk.  But that script is using the older, first version of get-esxcli.  Now I'm trying to get the same thing using -v2 version of get-esxcli and I just can't get it working.  The reason I'm doing this is I constantly get a warning saying that the older version is going to be deprecated soon.  The tool has provided some value to my organization and I want it to remain useful so if I can figure out how to switch to the -v2 I won't have to worry about when VMware deprecates the old version.  

So if I run get-esxcli -v2 now I get the following:
$esxcli.ssacli.cmd("ctrl all show status")
Method invocation failed because [VMware.VimAutomation.ViCore.Impl.V1.EsxCli.EsxCliElementImpl] does not contain a method named 'cmd'.


Has anyone converted any PowerCLI scripts to the -v2 version of get-esxcli?  And if so, can you help me understand what I'm missing?  If I figure this out myself I'll post here as well.

Thank you


Re: Need help with ssacli and PowerCLI



I would request you to reach out to the below mentioned communities and they will be assist you further .





I am a HPE Employee

Accept or Kudo

Occasional Visitor

Re: Need help with ssacli and PowerCLI

They point me here as ssacli is an HPE product.  I was hoping someone here had some expertise with PowerCLI.  Looks like I'm on my own with this one.  Thanks for trying.....

New Member

Re: Need help with ssacli and PowerCLI

connect-viserver <vcenterName>

$esxcli = get-esxcli -vmhost <esxhostname>

$ssacliargs = $esxcli.ssacli.cmd.createargs()

$ssacliargs.cmdopts = "ctrl slot=0 pd all show status"



instead of enumerating the args do this.

$esxcli.ssacli.cmd.invoke(@{cmdopts="ctrl slot=0 pd all show status"})



Occasional Visitor

Re: Need help with ssacli and PowerCLI

The second one worked. The first problem I had was with powercli install. I had an old version installed, and I had to force the side-by-side installation of the new version. Honestly, I had no idea how to do it, and it took me a while until I found a guide about it on Altaro. Before that, I was able to find YouTube videos about any topic, but there was nothing of use...
After that, I had ssacli problems, and this thread came to the rescue... These things are useful, but installing them can be a big hassle. I almost gave up on it a few times, but I knew that I had to find a solution...