VMware Cloud Community
MartinAmaro
Expert
Expert
Jump to solution

Is it possible to configure SSH in multiple hosts via script?

I have multiple servers that need to be configured for SSH, is there anyway to script it? Any ideas how to make this process automated or easier to execute on multiple vSphere hosts?

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

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

I suspect you are running this against an ESXi server ?

On ESXi you can enable "unsupported" SSH but there I'm afraid it's not possible with a cmdlet.

See VMware ESXi – How to enable SSH Connectivity. for instructions.

____________

Blog: LucD notes

Twitter: lucd22


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

View solution in original post

0 Kudos
7 Replies
LucD
Leadership
Leadership
Jump to solution

You can do this with the Set-VMHostFirewallException cmdlet.

Get-VMHost | Get-VMHostFirewallException | where {$_.Name -eq 'SSH Server'} | Set-VMHostFirewallException -Enabled $true -Confirm:$false

You can use the regular name masking on the Get-VMHost cmdlet, or you can insert another Where-Object cmdlet after the Get-VMHost cmdlet, if you want to select specific hosts.

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
MartinAmaro
Expert
Expert
Jump to solution

Thanks for the quick response

so I tried to first run the command against one host

Get-VMHost -Name Myhost.Domain.com | Get-VMHostFirewallException | where {$_.Name -eq 'SSH Server'} | Set-VMHostFirewallException -Enabled $true -Confirm:$false

But I get error

7/23/2010 9:21:37 AM Get-VMHostFirewallException 668C7891-9D8A-4E88-ABC4-7A36F9DD144E Couldn't obtain reference to the firewall system of host with id: HostSystem-host-18045.

Is this becuase it's ESXi vSphere 4 ? I'm not able to view the current Firewall Exception either 😕 Get-VMHost -Name Myhost.Domain.com | Get-VMHostFirewallException

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.
0 Kudos
LucD
Leadership
Leadership
Jump to solution

I suspect you are running this against an ESXi server ?

On ESXi you can enable "unsupported" SSH but there I'm afraid it's not possible with a cmdlet.

See VMware ESXi – How to enable SSH Connectivity. for instructions.

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
MartinAmaro
Expert
Expert
Jump to solution

I have the instructions how to do it manually 😕 There is no document for cmdlets that only work for ESXi correct? should we really be looking at not using ESXi?

Thanks for expressing your oppinion

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful.
0 Kudos
f10
Expert
Expert
Jump to solution

Hi,

http://kb.vmware.com/kb/1023990 provides a comparison between ESX and ESXi 4.x, review all the features and you have to take the call. There are pros and cons on using both the version all what I can say is that the future is with ESXi Smiley Happy

If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".

Regards, Arun Pandey VCP 3,4,5 | VCAP-DCA | NCDA | HPUX-CSA | http://highoncloud.blogspot.in/ If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
LucD
Leadership
Leadership
Jump to solution

That discussion is already going on for some time and will probably continue for some time to come.

If we reverse the question in "Why would you need to SSH to ESXi ?", there aren't (m)any real reasons left.

I think that VMW will have an alternative for all the tasks for which we need SSH by the time ESX will disappear.

If we like the alternatives, from a PowerCLI point of view, is another matter Smiley Wink

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
MartinAmaro
Expert
Expert
Jump to solution

Well.... Not everyone is the team likes to script or use powerCLI also VMware support does not feel confortable using it for troubleshooting ... They where the ones that ask for SSH to be turn on so they can look at logs quickly instead on changing to unsupported mode then look at logs Smiley Sad

Thank you both for you assistanse on this discussion.

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