Customization: Add general system and virtualization feature settings by nieubank · Pull Request #3268 · microsoft/devhome

@nieubank marked this pull request as ready for review

June 20, 2024 18:34

jsidewhite

jsidewhite

jsidewhite

bbonaby

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

dhoehna

nieubank

dhoehna

dhoehna

dhoehna

@nieubank

…settings

    - Updates `ManagementInfrastructureHelper.cs` for enhanced Windows feature management, including a refactored method for checking feature availability with modifications to return more detailed feature information.
    - Introduced a `RestartHelper.cs` class with a method to restart the computer immediately, to avoid disruption I did not point existing callers from Environments to this method since they have additional telemetry for this space. I can file an issue to track consolidation here.
    - Updated `WindowsIdentityHelper.cs` with a new method to check for whether a user has the capability to acquire administrative privileges, not just whether the current process is running elevated.
    - Added `WindowsOptionalFeatures.cs` and `WindowsOptionalFeatureState.cs` to represent Windows optional features, including a new static class for feature names and descriptions and a class to represent the state of an optional feature, specifically for UI.
    - Introduced `ModifyLongPathsSetting.cs` and `ModifyWindowsOptionalFeatures.cs` for enabling/disabling Windows settings and optional features through PowerShell scripts which require elevation. This allows the full script content to be visible to the user when accepting or rejecting the UAC prompt providing extra transparency, this is done in the same way as environments feature management. There are limitations here in that if scripts are blocked on the machine we're unable to make this changes, but until we finish security review on the elevated server, this is the best we've got.
    - Expanded Windows Customization with new views and dialogs for managing general system settings and virtualization features, including `GeneralSystemView`, `ModifyFeaturesDialog`, and `VirtualizationFeatureManagementPage`, alongside updates to existing views to accommodate these new features.

dhoehna

dhoehna

jsidewhite

- Updated ManagementInfrastructureHelper.cs to default `description` to an empty string if null.
- Changed `IsUserAdministrator` in WindowsIdentityHelper.cs to virtual for better extensibility.
- Enhanced WindowsOptionalFeatureState.cs with `[ObservableProperty]` for `_isEnabled` and added change notification.
- Modified PowerShell scripts in ModifyLongPathsSetting.cs and ModifyWindowsOptionalFeatures.cs for robust error handling with `$ErrorActionPreference='stop'`.
- Adjusted return value and simplified `ExitCode` in ModifyWindowsOptionalFeatures.cs for clarity and maintainability.
- Updated resource comments in Resources.resw for better clarity and localization support.
- Refactored exit code handling in ModifyWindowsOptionalFeaturesEvent.cs for consistency and removed no change for simplicity
- Adapted GeneralSystemViewModel.cs & VirtualizationFeatureManagementViewModel.cs to the non-static `IsUserAdministrator`.
- Improved XAML file readability and structure in various UI components.

@nieubank

joadoumie

@nieubank nieubank deleted the user/nieubank/custom_genvirt branch

June 25, 2024 18:24