I'm currently trying to generate a PowerCLI script that will configure the network adapters for a newly provisioned RHEL 6 VM. I've accomplished this with Windows 2012 R2, but for RHEL 6 I've noticed that some of the commands do not behave correctly when executed with Invoke-VMscript.
Executing ifconfig
or ping -c 2 localhost
locally on the VM as root performs as expected but when executing the command via Invoke-VMscript, the ScriptOutput block is blank. Running other commands such as pwd
, ls
, and cat /somefile
work as expected. Another clue is that the ll
command returns "bash: ll: command not found" while it works fine on the console.
I found the following VMware community article describing the same situation but it was not answered: https://communities.vmware.com/thread/467281
The exact command I'm using is
Invoke-VMscript -ScriptText "ifconfig" -VM $VM1 -GuestCredential $cred
I've tried using a non-root account as the guest credential but due to the escalation setup in use I get the following error: "A specfified parameter was not correct"