3

I have a bunch of machines that I need to enable Remote Scheduled Tasks Management (RPC), Remote Scheduled Tasks Management (RPC-EPMAP), and Windows Management Instrumentation (WMI-in) on for GPO Updates.

I would like to run a PowerShell script so I do not have to do this manually. However, I am new to powershell.

Is there a way I can get the powershell command when I add the rules manually at a machine?

EDIT:

This is one way I found to do it:

netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes
netsh advfirewall firewall set rule group="Remote Service Management" new enable=yes
netsh advfirewall firewall set rule group="Performance Logs and Alerts" new enable=yes
Netsh advfirewall firewall set rule group="Remote Event Log Management" new enable=yes
Netsh advfirewall firewall set rule group="Remote Scheduled Tasks Management" new enable=yes
netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
netsh advfirewall firewall set rule group="Windows Firewall Remote Management" new enable =yes
netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable =yes

However, I have to execute it on every machine.

For some reason, this one does not work:

Enable-NetFirewallRule -DisplayGroup “Windows Remote Management”
Jason
  • 3,931
  • 19
  • 66
  • 107
  • 3
    You didn't want to use the Starter GPO I linked to in your previous question and/or create a GPO to do this for you? – TheCleaner Jul 01 '14 at 19:16

2 Answers2

6

Working on Windows Server 2012 R2 Core, this worked for me:

Set-NetFirewallRule -DisplayGroup "File And Printer Sharing" -Enabled True

Here is how to check if it was succesful

Get-NetFirewallRule -DisplayGroup "File And Printer Sharing"

And find the value in "Enabled", it should be set to TRUE.

More info and arguments can be found here:

Set-NetFirewallRule Technet

c-chavez
  • 176
  • 1
  • 1
  • 1
    To enable it for specific access (i.e. domain, public, private networks), add the -Profile Domain|Public|Private argument. – Koen Zomers May 23 '16 at 17:00
3

According to this article on Technet, only on Server 2012 or Windows 8: http://technet.microsoft.com/en-us/library/hh831755.aspx

Windows 7 and Server 2008 require Netsh, even with Powershell 4.0.

Davidw
  • 1,222
  • 3
  • 14
  • 25