Solved

powershell install feature on multiple servers windows 2008 r2 servers

Posted on 2014-04-07
7
627 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
  • 3
  • 3
7 Comments
 
LVL 18

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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Utilizing an array to gracefully append to a list of EmailAddresses
Set OWA language and time zone in Exchange for individuals, all users or per database.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now