VMware Cloud Community
MattGoddard
Enthusiast
Enthusiast

Is it possible to run 'localcli' commands using PowerCLI?

I'm writing a PowerShell script to fix an issue with an ESXi host running on a UCS blade where adding NICs to the service profile in UCS Manager can cause virtual NIC aliases in ESXi to be shifte.... The script is complete...right up to the part where it needs to issue the command to update the physical NIC's vmnicX alias. That part I can't figure out.

The command, if run directly on the host, would be:

localcli --plugin-dir /usr/lib/vmware/esxcli/int/ deviceInternal alias store --bus-type pci --alias [alias] --bus-address [bus address]

I'm familiar with using the 'Get-EsxCli' commandlet to initiate 'esxcli' commands via PowerShell. Is there a similar way to run 'localcli' commands? And if so, how would I format that command to do the above?

(The host is running ESXi 5.5 U3h, btw. Yes, I know it's out of support. I'm in the process of upgrading!)

Reply
0 Kudos
4 Replies
StephenMoll
Expert
Expert

From what I read "localcli" is not supported and can cause problems, and "esxcli" should be used where possible.

When having to script stuff at the ESXi command line I have used PowerShell Gallery | Posh-SSH 2.1.

Reply
0 Kudos
MattGoddard
Enthusiast
Enthusiast

From what I read "localcli" is not supported

I read that too. However, using 'localcli' in this specific scenario is officially supported (scroll down to "Changing the names assigned by the ESXi host").

I have used PowerShell Gallery | Posh-SSH 2.1

Ah, yes, good call. I've used Posh-SSH before as well; I forgot about that.

That might be feasible as a workaround.

Reply
0 Kudos
scott28tt
VMware Employee
VMware Employee

Moderator: Moved to PowerCLI


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

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
LucD
Leadership
Leadership

If you have SSH running on the ESXi node, you can use that run most local commands on an ESXi node.

See Use Posh-SSH instead of PuTTY


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

Reply
0 Kudos