VMware ESXi systems provide a shell with specific commands like esxcli and works only on those nodes. I want to write a script to read the system IP from a file, login each system and execute the command esxcli network ip get
.
When I execute the script, that returns "command not found" error:
> "./snmp.sh: line 3: esxcli: command not found
Is there a way to fix this? The script is as below:
#!/bin/bash
while read host; do
ssh -n root@$host esxcli network ip get
done < esxi.txt
exscli
isn't in your PATH on the esxi server. Simplest fix is to use it with its full path (f.e. /usr/bin/esxcli
). You can find the valid path of the esxcli command on the esxi server with the command which esxcli
.