Enabling Windows Features and their dependencies...

Duchemin, Dominique 2,006 Reputation points
2022-05-13T06:03:24.393+00:00

Hello,

I am using this command:
Enable-WindowsOptionalFeature -Online -FeatureName “Windows-Defender-Features” -all

But the results is only for the main item "Windows Defender Features" which is enabled not the dependency "Windows Defender" ...

201577-2022-05-12-22-58-33-windows-defender.png

Thanks,
Dom

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
0 comments No comments
{count} votes

Accepted answer
  1. MotoX80 31,826 Reputation points
    2022-05-15T14:18:34.267+00:00

    Reference:

    https://learn.microsoft.com/en-us/powershell/module/dism/enable-windowsoptionalfeature?view=windowsserver2016-ps

    -NoRestart
    Suppresses reboot. If a reboot is not required, this command does nothing. This option will keep the application from prompting for a restart or keep it from restarting automatically.
    -All
    Enables all parent features of the specified feature. If a parent feature is required for the specified feature to be enabled in the image, All will enable the parent and all of its default dependencies.

    To supress the reboot prompt add the -norestart switch.

    As to why the GUI gets installed... I do not have a VM with the same OS as your server, so I can't test for you.

    Based on your replies you apparently have a parent feature; Windows-Defender-Features, and a sub feature; Windows-Defender.

    If you installed Windows-Defender, and it didn't work, then that would indicate to me that it's parent feature might also be required. But since you don't want the GUI, then you don't want to use the -All switch because the GUI might be tagged as a default.

    If you are testing on the same machine, make sure that all defender features are uninstalled and you reboot before trying again.

    Try this:

    Enable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender-Features" -NoRestart  
    Enable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender" -NoRestart  
    add shutdown to reboot if desired/required  
    

    Update: What is the issue with installing the GUI feature? If I have a server that I suspect is compromised, then I would RDP to it, verify that the definitions are up to date, and then initiate a full system scan, most likely using the GUI interface. I don't know what specific functionality that feature enables, but it seems to me that at worst, it shouldn't hurt anything, and at best, I would need it to manage Defender.

    1 person found this answer helpful.
    0 comments No comments

9 additional answers

Sort by: Most helpful
  1. Duchemin, Dominique 2,006 Reputation points
    2022-05-15T17:10:40.567+00:00

    Hello,

    Yes "Windows-Defender-Features" & "Windows-Defender" are dependent...

    I tried:
    202006-2022-05-15-10-03-55-vipsccmdp01-windows-defender-f.png

    then:
    202019-2022-05-15-10-08-02-vipsccmdp01-windows-defender-f.png

    Results:
    201940-2022-05-15-10-06-51-vipsccmdp01-windows-defender-f.png

    Thanks you for your help as the -NoRestart works so that a progress...
    The GUI I will live with it in for now and might ask Microsoft if they have idea why this is not working per Powershell as I think you proposed all options so not sure what's next...

    I will try another test on another machine maybe 2012 or 2019 to see how it reacts ...

    I tried the command line alone:
    Enable-WindowsOptionalFeature -Online -FeatureName "Windows-Defender" -NoRestart

    and both the "Windows-Defender" and "Windows-Defender-GUI" got enabled but not the parent "Windows-Defender-Features"

    Thanks,
    Dom

    0 comments No comments