Solved

powershell help. I want to run the netsh command and update firewall on multiple servers at once. how would i do it?

Posted on 2016-07-21
2
40 Views
Last Modified: 2016-07-21
Hi,
I would like to run the following netsh command and update firewall on multiple servers all at once. how would i do it?  this is cmd command not powershell. do you have a script to run it on multiple servers?

Thank you so much!

netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes
0
Comment
Question by:creative555
2 Comments
 
LVL 28

Accepted Solution

by:
becraig earned 500 total points
ID: 41723544
gc serverlist.txt | %  { 
invoke-command -cn $_ -scriptblock {
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes 
}
}

Open in new window

0
 

Author Closing Comment

by:creative555
ID: 41723954
thank you so much! Simple and nice :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

747 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

12 Experts available now in Live!

Get 1:1 Help Now