PowerShell

PowerShell: Installing Server Roles and Features on multiple Remote Servers

Install-WindowsFeature is a powerful cmdlet that enables you to install Roles and Features on Windows Server Operating Systems. In this article I am going to describe how to install Windows Server Backup on multiple Member Server in an Active Directory environment.

Preparation

I am logged in on a Domain Controller. I want to install Windows Server Backup on all Member Server of the domain, which are stored in a separate organizational unit.  Let´s get a list of them. Note that you have to edit the Distinguished Name of the Organizational Unit.

1.PNG

(Get-ADComputer -SearchBase "OU=Member Server,DC=pagr,DC=inet" -Filter *).Name

2.PNG

I strongly recommend checking the list. Otherwise you’ll catch the wrong.

Installing Windows Server Features on multiple Remote Hosts

To install, for example Windows Server Backup we have to combine our previous command with Foreach-Object. And now we call the shots:

(Get-ADComputer -SearchBase "OU=Member Server,DC=pagr,DC=inet" -Filter *).Name | Foreach-Object {Install-Windowsfeature Windows-Server-Backup}

To check whether the feature was installed successfully run Get-WindowsFeature.

Get-WindowsFeature -ComputerName server03 -Name Windows-Server-Backup

Unbenannt.PNG

Further thoughts

For installing Roles and Features you can also use PowerShell Remote Sessions: PowerShell Remoting: How to connect to Remote Hosts in a Domain- and in a Non-Domain Environment (Trusted Hosts)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.