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:
[php] Install-WindowsFeature -Name <feature_name>[/php]
In case that you want to install this role/feature on a remote server, this is the correct command structure:
[php]Install-WindowsFeature -Name <feature_name> -ComputerName <computer_name> -Restart[/php]
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:
[php]Install-WindowsFeature -Name Web-Server,Web-Mgmt-Console -Restart[/php]
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:
[php]Install-WindowsFeature -Name Web-Server,Web-Mgmt-Console -ComputerName BRNOLABDC -Restart[/php]
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: