Hello again. I was configuring Web server on one of my production servers by using PowerShell, so I said to myself that it was a good opportunity to show you how to configure roles or features by using Windows PowerShell.
You can configure features and roles with PowerShell locally, or remotely.
For the following procedure, please check if the remote server is configured to allow remote management (this is the default configuration setting) and that both source and destination servers are located in the same AD Services domain.
First things first, lets view a list of available and installed roles and features on the local server by running this command in PowerShell:
As you may see, list is quite long:
You can type Get-Help to view the syntax and accepted parameters for the Install-WindowsFeature cmdlet.
The structure of the command should be like this:
Install-WindowsFeature -Name <feature_name>
In case that you want to install this role/feature on a remote server, this is the correct command structure:
Install-WindowsFeature -Name <feature_name> -ComputerName <computer_name> -Restart
feature_name is the command name of a role or feature that you want to install (you can separate multiple values by using commas);
computer_name represents a remote computer on which you want to install roles and features;
-Restart automatically restarts the destination server if required by the role or feature installation.
Lets try to install Web Server (IIS 7.0) with Management Console.
First, lets do it locally:
Install-WindowsFeature -Name Web-Server,Web-Mgmt-Console -Restart
It didn’t require a restart. I just have a warning that Windows Auto Update is not enabled.
If I go to Server Manager, I can see IIS being installed:
IIS Manager was also installed:
Lets do the same thing, but this time remotely:
Install-WindowsFeature -Name Web-Server,Web-Mgmt-Console -ComputerName BRNOLABDC -Restart
After a successful installation, I have checked a remote server whether or not IIS was installed.
And it was installed successfully altogether with IIS Manager: