VMware Cloud Community
wamatha
Contributor
Contributor

Logon Banner script

Hallo

I need help with a powercli script to update the logon banner on all ESXi4.1 servers. We have about 60 ESXi hosts and would really appreciate a script to do this once

Thank you

Joseph

Reply
0 Kudos
12 Replies
alanrenouf
VMware Employee
VMware Employee

That reminds me of a script I wrote a while back, you should be able to adjust it...

http://www.virtu-al.net/2009/09/10/vtip-a-vmware-expert-updating-your-vi/

Alan

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
wamatha
Contributor
Contributor

I saw this one earlier, but I dont want to updat the MOTD file but rather edit the /etc/inetd.conf file and add the banner path so that when a user ssh to the server he/she get awarning message before they procced with entering password, with ESX we just edited the /etc/ssh/sshd_config file but with ESXi we have to edit /etc/inetd.coonf file

Joseph

Reply
0 Kudos
alanrenouf
VMware Employee
VMware Employee

That might be a little harder then, I would take a look at the plink.exe examples on this forum as that is the only way I can think of doing it, unless anyone else has a suggestion.

Blog: http://virtu-al.net Twitter: http://twitter.com/alanrenouf Co-author of the PowerCLI Book: http://powerclibook.com
Reply
0 Kudos
LucD
Leadership
Leadership

There is William's method (who else would figure this out) as described in How to enable SSH security banner on ESXi

But I don't immediatly see a way to automate this through a script.


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

Reply
0 Kudos
lamw
Community Manager
Community Manager

I'm a method now Luc? :smileyplain:

Reply
0 Kudos
wamatha
Contributor
Contributor

Yes Luc, this is the link am using to to manullay update the ESXi hosts, thoought someone has a script to push the message to all the hosts

Joseph

Reply
0 Kudos
LucD
Leadership
Leadership

A method, a concept, a legend, you're all of that Smiley Wink

Btw do you have a CLI script for that method ?


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

Reply
0 Kudos
wamatha
Contributor
Contributor

Thank you Luc,

I am looking for the script myself, please do your magic..

Joseph

Reply
0 Kudos
lamw
Community Manager
Community Manager

haha thanks Luc, it's a great compliment coming from the Master of PowerCLI.

I don't have canned script that does this per se, but there are a few options and it really just depends on how someone's environment is setup (e.g. ssh kesy being available & configured)

Basically I would suggest writing a simple shell script (ash script really for ESXi) and scping that over to the ESXi host, then you could setup a secondary SSH session that would execute the script. You could leverage this "expect" script that allows you to run a command on a host via SSH - http://vghetto.svn.sourceforge.net/viewvc/vghetto/other/sshlogin.exp?view=log

I'm sure you had a similiar idea, but basically either some type of SCP/expect or ssh keys if you have that configured to help you distribute the shell script + executing the script itself.

Reply
0 Kudos
aerodevil
Hot Shot
Hot Shot

I banged my head on this for a long time before giving it up.  I didn't see any method of readily doing it via a script.

Josh Atwell @Josh_Atwell http://www.vtesseract.com http://github.com/joshatwell/
Reply
0 Kudos
kunaludapi
Expert
Expert

vGeek: Change ssh banner / motd message file on all esxi servers using powercli

--------------------------------------------------------------- Kunal Udapi Sr. System Architect (Virtualization, Networking And Storage) http://vcloud-lab.com http://kunaludapi.blogspot.com VMWare vExpert 2014, 2015, 2016 If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
Reply
0 Kudos
monderick
Enthusiast
Enthusiast

noticed this was posted today to enable pre-password warning message.

of course scripting it will a bit more difficult but pushing the file out to all the hosts and recycling the service isn't terribly cumbersome.

http://www.vladan.fr/esxi-5-x-how-to-enable-ssh-pre-login-message-banner/

Reply
0 Kudos