Recently we got a situation where in we don’t know the passwords of either padmin/root of VIOS but need to run commands in VIOs.
Found an interesting command in HMC called “viosvrcmd“,which will enble us to run commands on VIOs through HMC.
Description: viosvrcmd issues an I/O server command line interface (ioscli) command to a virtual I/O server partition.
The ioscli commands are passed from the Hardware Management Console (HMC) to the virtual I/O server partition over an RMC session.
RMC does not allow interactive execution of ioscli commands.
-p VIOs hostname
–id The partion ID of the VIOs
Note:You must either use this option to specify the ID of the partition, or use the -p option to specify the partition’s name. The –id and the -p options are mutually exclusive.
-c The I/O server command line interface (ioscli) command to issue to the virtual I/O server partition.
Note: Command must be enclosed in double quotes. Also, command cannot contain the semicolon (;), greater than (>), or vertical bar (|) characters.
–help Display the help text for this command and exit.
Here is an example:
2.2.0.0
Since we can’t give the ; or > or | in the command , if you need to process the output using filters , you can use that after “”.
vfchost0 Available Virtual FC Server Adapter
What if you want to run command as root (oem_setup_env) ,
got a method from internet
> whoami”
root
You can run in one shot like below
hscroot@umhmc:~> viosvrcmd -m umfrm570 -p umvio1 -c “oem_setup_env\n whoami”
root
If you need to run multiple commands , you can use them by assiging the commands to a variable and call the variable in place of the command parameter.
hscroot@umhmc:~>viosvrcmd -m umfrm570 -p umvio1 -c “$command”