Skip to content

gracefully handle if servermanager not present#436

Merged
arudell merged 1 commit into
mainfrom
check-if-windowsfeature-cmd-available
May 20, 2025
Merged

gracefully handle if servermanager not present#436
arudell merged 1 commit into
mainfrom
check-if-windowsfeature-cmd-available

Conversation

@arudell

@arudell arudell commented May 20, 2025

Copy link
Copy Markdown
Member

Description

This pull request updates the Get-EnvironmentRole function in src/modules/SdnDiag.Utilities.psm1 to handle scenarios where the Get-WindowsFeature cmdlet may not be available. The change ensures that the function gracefully handles environments lacking this cmdlet by returning a default value.

Key changes:

  • Improved error handling for Get-WindowsFeature:
    • Added a check using Get-Command to verify the existence of the Get-WindowsFeature cmdlet before attempting to use it. If the cmdlet does not exist, the function now returns the default array @('Common') without attempting further operations.

Change type

  • Bug fix (non-breaking change)
  • Code style update (formatting, local variables)
  • New Feature (non-breaking change that adds new functionality without impacting existing)
  • Breaking change (fix or feature that may cause functionality impact)
  • Other

Checklist:

  • My code follows the style and contribution guidelines of this project.
  • I have tested and validated my code changes.

@arudell arudell requested a review from a team as a code owner May 20, 2025 22:08
@arudell arudell enabled auto-merge May 20, 2025 22:11
@arudell arudell added this pull request to the merge queue May 20, 2025
Merged via the queue into main with commit 8d39b5b May 20, 2025
4 checks passed
@arudell arudell deleted the check-if-windowsfeature-cmd-available branch May 20, 2025 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants