Greetings,
I need to edit two files in every ESXi host we have (hundreds). Is there a PowerCLI cmdlet to edit files? I've looked and cannot find such a thing. If not, does anyone have a suggestion how to do this without logging into every host? What I need to change is the following:
A. Edit /etc/vmware/logfilters and add the following lines:
5 | storageRM | .*
5 | sdrsInjector | .*
B. Edit /etc/vmsyslog.conf and add the following line:
enable_logfilters = true
C. Run command: "esxcli system syslog reload" for the configuration to take effect.
Are you allowed to enable/start SSH on the ESXi nodes?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
We are, yes. I even use a script I wrote to enable/disable SSH via PowerCLI to manage that, since Security doesn't want to SSH open unless we're actively using it.
Then you could use the Posh-SSH module to run a sed command on the ESXi node.
See for example Solved: Re: Need to alter a /etc/pam.d/password file but w... - VMware Technology Network VMTN
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you. Is there another way you can share the example from https://www.lucd.info/knowledge-base/use-posh-ssh-instead-of-putty/ ? That site is being blocked by our proxy. I've asked for permission to whitelist it but that may take a while, or it won't be approved at all.
Sure, it is just a short example
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thank you very much. I am trying to write the script to login to each host in a for loop and edit those two files. I am struggling but I think you have provided a way for me to be successful. I'm just not there yet.