Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 768
  • Last Modified:

powershell install feature on multiple servers windows 2008 r2 servers

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
techdrive
Asked:
techdrive
  • 3
  • 3
1 Solution
 
Raheman M. AbdulSenior Infrastructure Support Analyst & Systems DeveloperCommented:
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
 
Justin YeungSenior Systems EngineerCommented:
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
 
techdriveAuthor Commented:
I  guess I can run a for loop annable ps remoting.
0
Worried about phishing attacks?

90% of attacks start with a phish. It’s critical that IT admins and MSSPs have the right security in place to protect their end users from these phishing attacks. Check out our latest feature brief for tips and tricks to keep your employees off a hackers line!

 
Justin YeungSenior Systems EngineerCommented:
yes that will work
0
 
techdriveAuthor Commented:
enable remoting with multiple computers is not working out for me.
0
 
Justin YeungSenior Systems EngineerCommented:
why not?
0
 
techdriveAuthor Commented:
thanks for your solution I combined this with another one and was able to get this to work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now