Solved

powershell install feature on multiple servers windows 2008 r2 servers

Posted on 2014-04-07
7
674 Views
Last Modified: 2014-04-17
Hey guys I have been blessed with the tasks of installing the SNMP on multiple servers. I am somewhat confused on how to perform this since by hand I have to go to each server and place the following command


import-module servermanager
 and then type the following to install
add-windowsfeature <name of feature to install>


I have the list of servers saved in a text file and can reference them with get-content. Is there a way to install...As a bonus it would be great if I could add an entry in the tab of the service that get installed named snmp server. The tab names are traps  and security. In traps there is a community name and in security there is an accepted name. thanks for any help.
0
Comment
Question by:techdrive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
Raheman M. Abdul earned 500 total points
ID: 39983239
Is remoting enabled on the servers you are talking about?

You can try:

$servers = get-content c:\servers.txt
foreach ($server in $servers)
{
Invoke-Command -ComputerName $server -ScriptBlock { import-module servermanager
Start-Sleep -Seconds 15
add-windowsfeature <name of feature to install>

} -credential USERNAME


}
0
 
LVL 14

Expert Comment

by:Justin Yeung
ID: 39983292
you can't run invoke command since 2008 R2 by default doesn't accept PS remoting. (disabled by default)

unless it has been enabled via Group Policy.

however 2012 by default is enabled.
0
 

Author Comment

by:techdrive
ID: 39983947
I  guess I can run a for loop annable ps remoting.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:Justin Yeung
ID: 39984085
yes that will work
0
 

Author Comment

by:techdrive
ID: 39987166
enable remoting with multiple computers is not working out for me.
0
 
LVL 14

Expert Comment

by:Justin Yeung
ID: 39988627
why not?
0
 

Author Closing Comment

by:techdrive
ID: 40006327
thanks for your solution I combined this with another one and was able to get this to work.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Utilizing an array to gracefully append to a list of EmailAddresses
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question