Читать книгу Windows Server 2022 & Powershell All-in-One For Dummies - Sara Perrott - Страница 102

Configure Windows Firewall

Оглавление

Working with the Microsoft Defender Firewall on Server Core is pretty simple. You need to find the name of the rule you want to work with first. You can do that with the Get-NetFirewallRule command (see Figure 4-11). Using the Format-table command at the end makes the output more easily readable. Try the command without it — you'll see what I mean!

Get-NetFirewallRule *remote* | Format-table


FIGURE 4-11: Using Get-NetFirewallRule to find rules.

The preceding command looks for any rules that have remote in the name. You can see each rule and whether it's enabled.

Let’s enable the Remote Firewall Management rules. These would allow you to administer this server’s firewall from another system. The rules you’re interested in are RemoteFwAdmin-In-TCP and RemoteFWAdmin-RPCSS-In-TCP.

Here are the commands you'll use to enable these (see Figure 4-12):

Set-NetFirewallRule –Name "RemoteFwAdmin-In-TCP" –Enabled TrueSet-NetFirewallRule –Name "RemoteFwAdmin-RPCSS-In-TCP" –Enabled True

If the commands complete successfully, you’ll get no response. You’ll be returned to the PowerShell prompt. If you run your search again, you’ll see that these rules are now enabled.


FIGURE 4-12: Using PowerShell to set firewall rules and validate that they’re enabled.

Windows Server 2022 & Powershell All-in-One For Dummies

Подняться наверх