2

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”
  • 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 1 '14 at 19:16
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

  • 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.