none
Turning on/off Windows features with powershell RRS feed

  • Question

  • Hello Scripting guys,

       I am in the process of moving some of my computers from Windows 7 to Windows 10. We have a very large environment with a lot of Admin personnel. I am looking for a way that I can run a script to turn Windows features on for admin personal after an image or turn them off if the admin no longer needs them. I have done some research online and found that there are commands but they don't work for me (get-WindowsOptionalFeature, Enable-WindowsOptionalFeature); they all say that it is not a cmdlet. do I need a module? So as always I come to the experts. If I wanted to turn on the administrative features in a windows 7 or windows 10 box, what would be the best way?

    Thursday, October 13, 2016 1:59 PM

Answers

  • Well, I was unable to find out why I was getting no information however I was able to figure out how to enable the Features. so here is what I did.

    run Get-ClientFeature, you will see all of the features name and state. When turning on a feature you use the ADD-ClientFeature cmdlet (Add-ClientFeature -name (feature name). You have to use the entire name in the name column from your get-clientfeature output.  Without it, you will get a error.

    Example:

    PS C:\Windows\system32> Add-ClientFeature –Name RemoteServerAdministrationTools-Features-StorageManager -Force


    response:

    PS C:\Windows\system32> Add-ClientFeature –Name RemoteServerAdministrationTools-Features-StorageManager -Force

    Deployment Image Servicing and Management tool

    Version: 6.1.7600.16385

    Image Version: 6.1.7601.18489 Enabling feature(s)

    The operation completed successfully.

    Thanks guys; I hope this helps someone else.

    • Marked as answer by Richardlaw Thursday, October 13, 2016 5:12 PM
    Thursday, October 13, 2016 5:12 PM

All replies

  • The cmdlets seem to be new in Windows 10. They are not available in Windows 7.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    Thursday, October 13, 2016 3:21 PM
    Moderator
  • I was just informed that they are available in Windows 7 with the PSClientManager Module. They are built in to Windows 10. I am downloading and testing it  now. Thank you for the response.
    Thursday, October 13, 2016 3:25 PM
  • Too bad the help for the cmdlets don't make the requirements clear.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)


    Thursday, October 13, 2016 3:29 PM
    Moderator
  • So it is built in for Win 10 and for Win 7 you have to load the PSClientManager Module. after that its fairly simple.  Here is a good link for the Win 7.

      http://psclientmanager.codeplex.com/

    Thanks for your help.

    • Marked as answer by Richardlaw Thursday, October 13, 2016 4:20 PM
    • Unmarked as answer by Richardlaw Thursday, October 13, 2016 4:37 PM
    Thursday, October 13, 2016 4:20 PM
  • Now I am encountering an issue, for me to be able to successfully test this I will need to be able to enable a feature. When I use the Get-ClientFeatureInfo command I get a blank response or no response. Shown below. Any thoughts?

    When I try to use other features it outputs no response.

    Thursday, October 13, 2016 4:42 PM
  • You need to ask the author of the module. (We didn't write it.)

    -- Bill Stewart [Bill_Stewart]

    Thursday, October 13, 2016 4:47 PM
    Moderator
  • I will, thank you bill I will post any information I find.
    Thursday, October 13, 2016 4:49 PM
  • Well, I was unable to find out why I was getting no information however I was able to figure out how to enable the Features. so here is what I did.

    run Get-ClientFeature, you will see all of the features name and state. When turning on a feature you use the ADD-ClientFeature cmdlet (Add-ClientFeature -name (feature name). You have to use the entire name in the name column from your get-clientfeature output.  Without it, you will get a error.

    Example:

    PS C:\Windows\system32> Add-ClientFeature –Name RemoteServerAdministrationTools-Features-StorageManager -Force


    response:

    PS C:\Windows\system32> Add-ClientFeature –Name RemoteServerAdministrationTools-Features-StorageManager -Force

    Deployment Image Servicing and Management tool

    Version: 6.1.7600.16385

    Image Version: 6.1.7601.18489 Enabling feature(s)

    The operation completed successfully.

    Thanks guys; I hope this helps someone else.

    • Marked as answer by Richardlaw Thursday, October 13, 2016 5:12 PM
    Thursday, October 13, 2016 5:12 PM
  • The module is nothing but a wrapper around DISM:

    DISM /Online /Get-Features /Format:List

    You can do all of these things with DISM but the module creates objects from the strings for convenience.


    \_(ツ)_/

    Thursday, October 13, 2016 5:17 PM
  • Thank you JRV, I am going to look that up.
    Thursday, October 13, 2016 7:29 PM
  • DISM /?


    \_(ツ)_/

    Thursday, October 13, 2016 7:34 PM