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
45 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 29

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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
This article will help you understand what HashTables are and how to use them in PowerShell.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

863 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

18 Experts available now in Live!

Get 1:1 Help Now