Managing Windows features from the command line with RSAT

      Comments Off on Managing Windows features from the command line with RSAT

Note: An update of this article for Windows 10 can be found here

One of the more useful Windows features for Windows administrators is the Remote Server Administration Tools pack (RSAT).

Apart from allowing you to install GUI elements in the Administrative Tools menu, this can also install the command-line tools for querying and managing Active Directory: dsquery.exe, dsadd.exe, dsget.exe, dsmod.exe, dsmove.exe and dsrm.exe.

Note from Microsoft:
**Remote Server Administration Tools for Windows 7 with SP1 can be installed ONLY on computers that are running the Enterprise, Professional, or Ultimate editions of Windows 7 or Windows 7 with SP1.**

The version for Windows 7 can be used to manage Windows 2003, 2008 and W2008 R2, and can be obtained here.

For completeness: The version for Windows 8 can be used to manage Windows 2012, and can be obtained here. I have not tested that version, however, as I don’t use Windows 8.

To manage features using the command line, use the dism command.
This command can also be used to enable features on Windows 2008 and 2012 servers.

The dism command also works if your no-brain domain administrator has used a policy to disable the Features management (“Turn Windows features on or off“) in the Programs and Features control panel. Of course, you do need to be a local administrator.

By the way, that policy is stored in the registry at

HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionPoliciesPrograms
Name: NoWindowsFeatures
Type: DWORD
Change to 0 to enable the feature management

This is the reg command to disable the policy:

reg add HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Programs /v NoWindowsFeatures /t REG_DWORD /d 0 /f

To list all the features available on a PC, and their state (disabled/enabled), use:

dism /online /get-features

For instance, to install the Telnet Client, use:

dism /online /enable-feature /featurename:TelnetClient

Or, if you need to print to an LPR printer on your network, you need to install the LPR print port monitor:

dism /online /enable-feature /featurename:Printing-Foundation-LPRPortMonitor

Be aware that the feature names are case-sensitive. The /featurename parameter can be repeated multiple times, and some features have dependencies which need to be specified before them on the command line. The dism command will report failures because of dependencies, so you can build a correct command line by experimenting.

To install the Active Directory components from the RSAT tools pack, you need first to download and install the pack (duh).
Then, the following command installs the AD tools, including the ds* command line tools:

dism /online /enable-feature /featurename:RemoteServerAdministrationTools /featurename:RemoteServerAdministrationTools-Roles /featurename:RemoteServerAdministrationTools-Roles-AD /featurename:RemoteServerAdministrationTools-Roles-AD-DS /featurename:RemoteServerAdministrationTools-Roles-AD-DS-SnapIns /featurename:RemoteServerAdministrationTools-Roles-AD-Powershell /featurename:RemoteServerAdministrationTools-Roles-AD-DS-AdministrativeCenter

Available Windows 7 Enterprise features (sorted by name):

Chess
ClientForNFS-Infrastructure
CorporationHelpCustomization
FaxServicesClientPackage
FreeCell
Hearts
IIS-ASP
IIS-ASPNET
IIS-ApplicationDevelopment
IIS-BasicAuthentication
IIS-CGI
IIS-ClientCertificateMappingAuthentication
IIS-CommonHttpFeatures
IIS-CustomLogging
IIS-DefaultDocument
IIS-DigestAuthentication
IIS-DirectoryBrowsing
IIS-FTPExtensibility
IIS-FTPServer
IIS-FTPSvc
IIS-HealthAndDiagnostics
IIS-HostableWebCore
IIS-HttpCompressionDynamic
IIS-HttpCompressionStatic
IIS-HttpErrors
IIS-HttpLogging
IIS-HttpRedirect
IIS-HttpTracing
IIS-IIS6ManagementCompatibility
IIS-IISCertificateMappingAuthentication
IIS-IPSecurity
IIS-ISAPIExtensions
IIS-ISAPIFilter
IIS-LegacyScripts
IIS-LegacySnapIn
IIS-LoggingLibraries
IIS-ManagementConsole
IIS-ManagementScriptingTools
IIS-ManagementService
IIS-Metabase
IIS-NetFxExtensibility
IIS-ODBCLogging
IIS-Performance
IIS-RequestFiltering
IIS-RequestMonitor
IIS-Security
IIS-ServerSideIncludes
IIS-StaticContent
IIS-URLAuthorization
IIS-WMICompatibility
IIS-WebDAV
IIS-WebServer
IIS-WebServerManagementTools
IIS-WebServerRole
IIS-WindowsAuthentication
InboxGames
Indexing-Service-Package
Internet Backgammon
Internet Checkers
Internet Games
Internet Spades
Internet-Explorer-Optional-amd64
MSMQ-ADIntegration
MSMQ-Container
MSMQ-DCOMProxy
MSMQ-HTTP
MSMQ-Multicast
MSMQ-Server
MSMQ-Triggers
MSRDC-Infrastructure
MediaCenter
MediaPlayback
Minesweeper
More Games
NFS-Administration
NetFx3
OEMHelpCustomization
OpticalMediaDisc
Printing-Foundation-Features
Printing-Foundation-InternetPrinting-Client
Printing-Foundation-LPDPrintService
Printing-Foundation-LPRPortMonitor
Printing-XPSServices-Features
PurblePlace
RasRip
SNMP
SUA
ScanManagementConsole
SearchEngine-Client-Package
ServicesForNFS-ClientOnly
Shanghai
SimpleTCP
Solitaire
SpiderSolitaire
TFTP
TIFFIFilter
TabletPCOC
TelnetClient
TelnetServer
WAS-ConfigurationAPI
WAS-NetFxEnvironment
WAS-ProcessModel
WAS-WindowsActivationService
WCF-HTTP-Activation
WCF-NonHTTP-Activation
WMISnmpProvider
WindowsGadgetPlatform
WindowsMediaPlayer
Xps-Foundation-Xps-Viewer

Available Remote Server Administration Tools features:

RemoteServerAdministrationTools
RemoteServerAdministrationTools-Features
RemoteServerAdministrationTools-Features-BitLocker
RemoteServerAdministrationTools-Features-Clustering
RemoteServerAdministrationTools-Features-GP
RemoteServerAdministrationTools-Features-LoadBalancing
RemoteServerAdministrationTools-Features-SmtpServer
RemoteServerAdministrationTools-Features-StorageExplorer
RemoteServerAdministrationTools-Features-StorageManager
RemoteServerAdministrationTools-Features-Wsrm
RemoteServerAdministrationTools-Roles
RemoteServerAdministrationTools-Roles-AD
RemoteServerAdministrationTools-Roles-AD-DS
RemoteServerAdministrationTools-Roles-AD-DS-AdministrativeCenter
RemoteServerAdministrationTools-Roles-AD-DS-NIS
RemoteServerAdministrationTools-Roles-AD-DS-SnapIns
RemoteServerAdministrationTools-Roles-AD-LDS
RemoteServerAdministrationTools-Roles-AD-Powershell
RemoteServerAdministrationTools-Roles-CertificateServices
RemoteServerAdministrationTools-Roles-CertificateServices-CA
RemoteServerAdministrationTools-Roles-CertificateServices-OnlineResponder
RemoteServerAdministrationTools-Roles-DHCP
RemoteServerAdministrationTools-Roles-DNS
RemoteServerAdministrationTools-Roles-FileServices
RemoteServerAdministrationTools-Roles-FileServices-Dfs
RemoteServerAdministrationTools-Roles-FileServices-Fsrm
RemoteServerAdministrationTools-Roles-FileServices-StorageMgmt
RemoteServerAdministrationTools-Roles-HyperV
RemoteServerAdministrationTools-Roles-RDS
RemoteServerAdministrationTools-ServerManager