Commit 8d39b5b
authored
gracefully handle if servermanager not present (#436)
# 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
- [x] 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:
- [x] My code follows the style and contribution guidelines of this
project.
- [x] I have tested and validated my code changes.1 parent 8546802 commit 8d39b5b
1 file changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2883 | 2883 | | |
2884 | 2884 | | |
2885 | 2885 | | |
2886 | | - | |
2887 | | - | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
2888 | 2895 | | |
2889 | 2896 | | |
2890 | 2897 | | |
| |||
0 commit comments