Skip to content

Commit

Permalink
feat: enhancements to Add-vRLISmtpConfiguration
Browse files Browse the repository at this point in the history
- Enhanced `Add-vRLISmtpConfiguration` cmdlet to perform multiple attempts at checking the configuration is applied correctly before failing.
- Updated Documentation.

Signed-off-by: Gary Blake <gblake@vmware.com>
  • Loading branch information
GaryJBlake committed Sep 18, 2024
1 parent dcea635 commit 7e989e6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 25 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
- Enhanced `Test-CcmPrerequisite` cmdlet to ensure all associated DNS entries are resolvable for both forward and reverse lookups.
- Enhanced `Test-PdrPrerequisite` cmdlet to verify that NSX Federation is configured in the environment.
- Enhanced `Get-WsaDirectory` cmdlet with a -domainName parameter as an input and validation of authentication token.
- Enhanced `Add-vRLISmtpConfiguration` cmdlet to perform multiple attempts at checking the configuration is applied correctly before failing.
- Removed Alias `Request-NsxToken` from `Request-NsxtToken` cmdlet.

## v2.11.1
Expand Down
2 changes: 1 addition & 1 deletion PowerValidatedSolutions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
RootModule = 'PowerValidatedSolutions.psm1'

# Version number of this module.
ModuleVersion = '2.12.0.1031'
ModuleVersion = '2.12.0.1032'

# ID used to uniquely identify this module
GUID = 'a6dfed7b-65d2-4da2-bdcc-7f3d3df9b75d'
Expand Down
26 changes: 22 additions & 4 deletions PowerValidatedSolutions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -14617,8 +14617,12 @@ Function Add-vRLISmtpConfiguration {
- Configures SMTP server settings in VMware Aria Operations for Logs if not already configured

.EXAMPLE
Add-vRLISmtpConfiguration -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! -smtpServer smtp.rainpole.io -port 25 -sender administrator@rainpole.io
This example configures the SMTP server settings on VMware Aria Operations for Logs.
Add-vRLISmtpConfiguration -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! -smtpServer smtp.rainpole.io -port 25 -sender aria-operations-for-logs-no-reply@rainpole.io
This example configures the SMTP server settings on VMware Aria Operations for Logs where no authentication is required.

.EXAMPLE
Add-vRLISmtpConfiguration -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! -smtpServer smtp.rainpole.io -port 25 -sender aria-operations-for-logs-no-reply@rainpole.io -smtpUser administrator@rainpole.io -smtpPass VMw@re1!
This example configures the SMTP server settings on VMware Aria Operations for Logs where authentication to the SMTP server is required.

.PARAMETER server
The fully qualified domain name of the SDDC Manager.
Expand Down Expand Up @@ -14665,8 +14669,7 @@ Function Add-vRLISmtpConfiguration {
if (Test-Connection -ComputerName $smtpServer -Quiet -Count 1) {
if (!(Get-vRLISmtpConfiguration | Where-Object { $_.server -eq $smtpServer })) {
Set-vRLISmtpConfiguration -smtpServer $smtpServer -port $port -sender $sender -username $smtpUser -password $smtpPass | Out-Null
Start-Sleep 2
if (Get-vRLISmtpConfiguration | Where-Object { $_.server -eq $smtpServer }) {
if (Request-ConfigurationCheck -timeoutSeconds 300 -command "Get-vRLISmtpConfiguration | Where-Object { $_.server -eq $smtpServer }") {
Write-Output "Configuring SMTP Server in VMware Aria Operations for Logs ($($vcfVrliDetails.fqdn)) with SMTP server ($smtpServer): SUCCESSFUL"
} else {
Write-Error "Configuring SMTP Server in VMware Aria Operations for Logs ($($vcfVrliDetails.fqdn)) with SMTP server ($smtpServer): POST_VALIDATION_FAILED"
Expand Down Expand Up @@ -62092,6 +62095,21 @@ namespace CertificateCapture
Return $subject
}

Function Request-ConfigurationCheck {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$timeoutSeconds,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$command
)

$timeout = New-TimeSpan -Seconds $timeoutSeconds
$endTime = (Get-Date).Add($timeout)
Do {
$configCheck = $command
}
Until ($configCheck -or ((Get-Date) -gt $endTime))
$configCheck
}

#EndRegion End Utility Functions ######
###################################################################################

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Synopsis

Configure SMTP settings in VMware Aria Operations for Logs
Configure SMTP settings in VMware Aria Operations for Logs.

## Syntax

```powershell
Add-vRLISmtpConfiguration [-server] <String> [-user] <String> [-pass] <String> [-smtpServer] <String> [-port] <String> [-sender] <String> [[-smtpUser] <String>] [[-smtpPass] <String>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Add-vRLISmtpConfiguration [-server] <String> [-user] <String> [-pass] <String> [-smtpServer] <String> [-port] <String> [-sender] <String> [[-smtpUser] <String>] [[-smtpPass] <String>] [<CommonParameters>]
```

## Description
Expand All @@ -26,10 +26,18 @@ The cmdlet connects to SDDC Manager using the -server, -user, and -password valu
### Example 1

```powershell
Add-vRLISmtpConfiguration -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! -smtpServer smtp.rainpole.io -port 25 -sender administrator@rainpole.io
Add-vRLISmtpConfiguration -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! -smtpServer smtp.rainpole.io -port 25 -sender aria-operations-for-logs-no-reply@rainpole.io
```

This example configures the SMTP server settings on VMware Aria Operations for Logs.
This example configures the SMTP server settings on VMware Aria Operations for Logs where no authentication is required.

### Example 2

```powershell
Add-vRLISmtpConfiguration -server sfo-vcf01.sfo.rainpole.io -user administrator@vsphere.local -pass VMw@re1! -smtpServer smtp.rainpole.io -port 25 -sender aria-operations-for-logs-no-reply@rainpole.io -smtpUser administrator@rainpole.io -smtpPass VMw@re1!
```

This example configures the SMTP server settings on VMware Aria Operations for Logs where authentication to the SMTP server is required.

## Parameters

Expand Down Expand Up @@ -161,22 +169,6 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -ProgressAction
Progress Action
```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### Common Parameters
This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).

0 comments on commit 7e989e6

Please sign in to comment.