Solved

powershell install feature on multiple servers windows 2008 r2 servers

Posted on 2014-04-07
7
619 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
Comment Utility
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
Comment Utility
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
Comment Utility
I  guess I can run a for loop annable ps remoting.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 14

Expert Comment

by:Justin Yeung
Comment Utility
yes that will work
0
 

Author Comment

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

Expert Comment

by:Justin Yeung
Comment Utility
why not?
0
 

Author Closing Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Set OWA language and time zone in Exchange for individuals, all users or per database.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

771 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

11 Experts available now in Live!

Get 1:1 Help Now