Added new vCenter Login Banner run command with test coverage#413
Open
Kavyareddyguntaka11 wants to merge 9 commits into
Open
Added new vCenter Login Banner run command with test coverage#413Kavyareddyguntaka11 wants to merge 9 commits into
Kavyareddyguntaka11 wants to merge 9 commits into
Conversation
…, with non-blocking warning guidance
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new AVS Run Command cmdlets to manage the vCenter (VCSA) login banner via the pre-established SSH session, including compatibility fallbacks across VCSA variants, plus accompanying Pester coverage and module manifest updates.
Changes:
- Added
Set-VCLoginBanner,Get-VCLoginBanner, andRemove-VCLoginBannercmdlets (with inline/file content fallback, consent toggle fallback, and optional UI page-source verification). - Added
Normalize-VCBannerTexthelper for banner text normalization/cleanup prior to issuing VCSA commands. - Updated module manifest exports/version and extended Pester tests for the new cmdlets and fallback paths.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/Microsoft.AVS.Management.Tests.ps1 | Adds Pester coverage for banner text normalization and the new login banner cmdlets (including multiple fallback scenarios). |
| Microsoft.AVS.Management/Microsoft.AVS.Management.psm1 | Implements the new login banner cmdlets using sso-config.sh via Invoke-SSHCommand, with fallback handling and optional verification. |
| Microsoft.AVS.Management/Microsoft.AVS.Management.psd1 | Bumps module version and exports the new cmdlets. |
| Microsoft.AVS.Management/AVSGenericUtils.ps1 | Adds Normalize-VCBannerText helper used by the new cmdlets. |
Comment on lines
+184
to
+188
| # Remove emojis and unsupported symbols, while preserving letters, numbers, | ||
| # punctuation, spaces, and new lines. | ||
| $String = $String -replace '[^\p{L}\p{N}\p{P}\p{Zs}\r\n]', '' | ||
|
|
||
| # Collapse repeated spaces and tabs per line, preserving line breaks. |
Contributor
Author
There was a problem hiding this comment.
Fixed banner test normalize to preserve tabs and collapse.
Comment on lines
+2060
to
+2062
| Describe "Get-VCLoginBanner" { | ||
| Context "Fallback Path" { | ||
| It "Should fallback to print command and set NamedOutputs when get command fails" { |
Comment on lines
+2116
to
+2118
| Describe "Remove-VCLoginBanner" { | ||
| Context "Fallback Path" { | ||
| It "Should retry with fallback disable command when primary disable command fails" { |
…test cases of missing SSH for get and remove
et1975
previously approved these changes
Jul 14, 2026
… and fallback to -print_logon_banner
The fallback banner-file commands wrapped single-quote-escaped, user-controlled
text inside an outer /bin/sh -c "..." (double quotes) with a second shell parse.
The POSIX single-quote escape ('"'"') and any literal double quote broke out of
the outer double quotes, allowing arbitrary command execution as root on the VCSA.
Run mkdir/printf/rm directly through the remote login shell (single parse) so the
single-quote escaping the primary path already relies on is sufficient. Add
regression tests (structural + real-shell execution) under Set-VCLoginBanner.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e4e1a2df-e3b1-49f0-833c-04f0ffc8b7b2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR closes WI-36631481
The changes in this PR are as follows:
Added new vCenter Login Banner run commands:
Set-VCLoginBannerGet-VCLoginBannerRemove-VCLoginBannerImplemented compatibility and fallback handling for VCSA variants, including:
Added and updated Pester test coverage for the new login banner run commands, including:
I have read the contributor guidelines and have completed the following:
AVSAttributeto newly exported functions.