Monday, October 21, 2019

NSX | How to disable SSH on all NSX edges?


Enabled SSH can be a security threat so it is recommended to keep it disabled and enable only when highly required.

Again disabling it manually is a tedious task (at least for me) so I thought to do it through powershell.

Below example is for selected edges, in case you want it to run for all then simply remove the source file and run "Get-Nsxedge". 

To disable SSH on selected Edges
 
#Connect NSX Manager and replace 1.1.1.1 with actual IP address of NSX Manager
Connect-NsxServer -nsxserver 1.1.1.1
#put a file with edge-ID in below location. In case you want to disable on selected edges
foreach($edgelist in (Get-Content -Path C:\TEMP\edgelist.txt)){
#below command will disable ssh on all the mentioned edges in above .txt file 
Get-NsxEdge -objectId $edgelist | Disable-NsxEdgeSsh -Confirm:$false
#Let's cross check the status after disabling it
$ssh = Get-NsxEdge -objectId $edgelist
$ssh.id
$ssh.clisettings.remoteaccess
}


To disable SSH on all NSX edges.
 Connect-NsxServer -nsxserver 1.1.1.1
 Get-NsxEdge  | Disable-NsxEdgeSsh -Confirm:$false
 


Any query? Feel free to ask.



Thank you,
Team vCloudNotes


0 comments:

Post a Comment

Sponsor

AD BANNER
Powered by Blogger.
The Magazine

Text Widget

Facebook

Extra Ads

AD BANNER

Welcome to my Notes!

Hello Folks, My name is Gautam Johar. Actively working on VMware Cloud and keen to learn new and latest cloud technologies in market. Love ...

Contact Form

Name

Email *

Message *

Followers



Labels

Translate

Breaking

Random Posts

Follow Us

On Linkedin

Recent Posts

Recent Comments

Header Ads

Popular Posts

Popular Posts

Recent Posts

Text Widget

Search This Blog

Copyright © test blog | Powered by Blogger
Design by Saeed Salam | Blogger Theme by NewBloggerThemes.com