VMware Cloud Community
nava_thulasi39

Can we edit the file using invoke-sshcommand?

Hi,

I found the below article to use ssh session by powercli.

SSH from PowerShell using the SSH.NET library - Svendsen Tech Powershell Wiki

Now I wonder, using the invoke-sshcommand is it possible to use vi command to edit some config files in the esxi server?

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
1 Reply
LucD
Leadership
Leadership

I don't think it is easy to automate (script) the vi editor, which is a full-screen editor.

But sed, which is a line editor, should be a lot easier to automate.

An alternative could be to copy over the file to your station from within the script (SCP), do the changes in PowerShell, and then copy the file back.


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

0 Kudos