Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

LDR Password / SSH Options #472

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions module/PowerNSX.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -11460,6 +11460,18 @@ function New-NsxLogicalRouter {
#Optional tenant string to be configured on the DLR.
[ValidateNotNullOrEmpty()]
[String]$Tenant,
[Parameter (Mandatory=$false)]
#Cli account username.
[ValidateNotNullOrEmpty()]
[String]$Username="admin",
[Parameter (Mandatory=$true)]
#CLI account password
[ValidateNotNullOrEmpty()]
[String]$Password,
[Parameter (Mandatory=$false)]
#Enable SSH
[ValidateNotNullOrEmpty()]
[switch]$EnableSSH=$false,
[Parameter (Mandatory=$False)]
#PowerNSX Connection object
[ValidateNotNullOrEmpty()]
Expand Down Expand Up @@ -11503,6 +11515,19 @@ function New-NsxLogicalRouter {
Add-XmlElement -xmlRoot $xmlAppliance -xmlElementName "resourcePoolId" -xmlElementText $ResPoolId
Add-XmlElement -xmlRoot $xmlAppliance -xmlElementName "datastoreId" -xmlElementText $datastore.extensiondata.moref.value

#CLI Settings
if ( $PsBoundParameters.ContainsKey('EnableSSH') -or $PSBoundParameters.ContainsKey('Password') ) {

[System.XML.XMLElement]$xmlCliSettings = $XMLDoc.CreateElement("cliSettings")
$xmlRoot.appendChild($xmlCliSettings) | out-null

if ( $PsBoundParameters.ContainsKey('Password') ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to check because it is always a value...

Add-XmlElement -xmlRoot $xmlCliSettings -xmlElementName "userName" -xmlElementText $UserName
Add-XmlElement -xmlRoot $xmlCliSettings -xmlElementName "password" -xmlElementText $Password
}
if ( $PsBoundParameters.ContainsKey('EnableSSH') ) { Add-XmlElement -xmlRoot $xmlCliSettings -xmlElementName "remoteAccess" -xmlElementText $EnableSsh.ToString().ToLower() }
}

if ( $EnableHA ) {
[System.XML.XMLElement]$xmlAppliance = $XMLDoc.CreateElement("appliance")
$xmlAppliances.appendChild($xmlAppliance) | out-null
Expand Down