locked
making a feature activation script from existing server RRS feed

  • Question

  • Hi,

    I am dealing with a couple of tricky software packages requiring some rarely used features in Windows like the IIS6 compatibility things in the IIS role. So far there are 4 roles and 60 features to be activated I want to do two things:

    1.) read out the installed roles / features

    Import-Module Servermanager

    Get-WindowsFeature | ? { $_.Installed } | Export-Clixml .\features.xml

    Import-Clixml .\features.xml

    This gives me a list what is installed... however not in a way that I can process that beacuse of it's ugly formatting and dotted things in case a feautre has too long name. I just need the name of the feature without cutoff of it's name...

    2.) I want to automatically create a feature activation script for being able to easily clone the roles / features from one system to another. Here I also need some help how to get this into a file... I know that I can activate single role / features with a simple command... but how to get these into a file?

    Add-WindowsFeature WAS-Config-APIs


    IT architect - Terminal servers, virtualizations, SQL servers, file servers, WAN networks and closely related to software devleopment (8 years + experience in VB, C++ and script langugaes), MCP for SQL server and CCAA for Xenapp 6.5


    • Edited by Al Hasoob Friday, November 17, 2017 12:53 PM
    Friday, November 17, 2017 12:51 PM

All replies

  • The screen out put is not the results it is a rendering of the results.

    Get-WindowsFeature | Format-List

    Your first step should be to learn PowerShell. PowerShell produces objects. You would also do best by learning about object systems and OOP.


    \_(ツ)_/

    Friday, November 17, 2017 4:19 PM
  • Sometimes just a simple hint is needed, because things complicated for one person are simple for somebody else, this is the principle of a discussion form. Telling me to learn PS is not the answer ...

    Powershell is sometimes helpful, but the language is not consistent over the OS versions so it is not a good tool becasue I have to verify my scripts against every new OS.

    a) the feature administration behaves different, options are not consistent, and in Windows 7 there is no PS inteface to feature and role administration at all. It's DISM and DISM is dead slow compared to the feature administration via PS in Windows 10 or in the server OS

    b) the language itself has undergone fundamental changes, for example in PS of Windows 7 a variable is just always global if declared before a function block begins, in the PS on Windows 2016 variables from the main code are not valid inside of a function any more. Not to mention all of the Perl alike string operations...  and the inconsistent feature naming starting with Windows 2016


    IT architect - Terminal servers, virtualizations, SQL servers, file servers, WAN networks and closely related to software devleopment (8 years + experience in VB, C++ and script langugaes), MCP for SQL server and CCAA for Xenapp 6.5

    Monday, November 20, 2017 10:03 AM
  • You asked a question about PowerShell.  There is no other better answer and we cannot address your complaints.  If PowerShell does not work for you there is no need for you to feel obligated to use it.


    \_(ツ)_/

    Monday, November 20, 2017 10:31 AM