Manage Windows features via the ServerManager powershell module. Can list available and installed roles/features. Can install and remove roles/features.
Shane Lee <firstname.lastname@example.org>
Windows Server 2008R2 or greater
install(feature, recurse=False, restart=False, source=None, exclude=None)¶
Install a feature
Some features require reboot after un/installation, if so until the server is restarted other features can not be installed!
Some features take a long time to complete un/installation, set -t with a long timeout
The name of the feature(s) to install. This can be a single feature, a string of features in a comma delimited list (no spaces), or a list of features.
New in version 2018.3.0: Added the ability to pass a list of features to be installed.
recurse (Options[bool]) -- Install all sub-features. Default is False
restart (Optional[bool]) -- Restarts the computer when installation is complete, if required by
the role/feature installed. Will also trigger a reboot if an item
exclude requires a reboot to be properly removed. Default is
source (Optional[str]) -- Path to the source files if missing from the target system. None means that the system will use windows update services to find the required files. Default is None
exclude (Optional[str]) --
The name of the feature to exclude when installing the named feature. This can be a single feature, a string of features in a comma-delimited list (no spaces), or a list of features.
As there is no exclude option for the
Install-WindowsFeature PowerShell commands the features
exclude will be installed with other sub-features
and will then be removed. If the feature named in ``exclude``
is not a sub-feature of one of the installed items it will still
A dictionary containing the results of the install
# Install the Telnet Client passing a single string salt '*' win_servermanager.install Telnet-Client # Install the TFTP Client and the SNMP Service passing a comma-delimited # string. Install all sub-features salt '*' win_servermanager.install TFTP-Client,SNMP-Service recurse=True # Install the TFTP Client from d:\side-by-side salt '*' win_servermanager.install TFTP-Client source=d:\\side-by-side # Install the XPS Viewer, SNMP Service, and Remote Access passing a # list. Install all sub-features, but exclude the Web Server salt '*' win_servermanager.install "['XPS-Viewer', 'SNMP-Service', 'RemoteAccess']" True recurse=True exclude="Web-Server"
List available features to install
A list of available features as returned by the
Get-WindowsFeature PowerShell command
salt '*' win_servermanager.list_available
List installed features. Supported on Windows Server 2008 and Windows 8 and newer.
A dictionary of installed features
salt '*' win_servermanager.list_installed
remove(feature, remove_payload=False, restart=False)¶
Remove an installed feature
Some features require a reboot after installation/uninstallation. If
one of these features are modified, then other features cannot be
installed until the server is restarted. Additionally, some features
take a while to complete installation/uninstallation, so it is a good
idea to use the
-t option to set a longer timeout.
The name of the feature(s) to remove. This can be a single feature, a string of features in a comma delimited list (no spaces), or a list of features.
New in version 2018.3.0: Added the ability to pass a list of features to be removed.
remove_payload (Optional[bool]) -- True will cause the feature to be removed from the side-by-side
%SystemDrive%:\Windows\WinSxS). Default is False
restart (Optional[bool]) -- Restarts the computer when uninstall is complete, if required by the role/feature removed. Default is False
A dictionary containing the results of the uninstall
salt -t 600 '*' win_servermanager.remove Telnet-Client