简体   繁体   English

使用 powershell 命令关闭防火墙

[英]turn off firewall with powershell command

I'm working on a command in Powershell that will look at the firewall (Domain) name (Enabled) and depending on if it's True the command will set it to false switching it off locally for the workstation.我正在 Powershell 中处理一个命令,该命令将查看防火墙(域)名称(已启用),并根据它是否为 True,该命令会将其设置为 false,为工作站在本地关闭它。

right now I have this:现在我有这个:

if (((Get-NetFirewallProfile -profile Domain,Enabled) | where { $_.Enabled -eq $True } | Set-NetFirewallProfile -Profile Domain -Enabled False

This is not working for me, it's not even giving me an error so I can't work out what is missing, can anyone see my mistake?这对我不起作用,它甚至没有给我一个错误,所以我无法弄清楚缺少什么,有人能看到我的错误吗?

The command will be used on windows 10该命令将在 Windows 10 上使用

I think your issue is with Get-NetFirewallProfile -profile Domain,Enabled .我认为您的问题与Get-NetFirewallProfile -profile Domain,Enabled The -Profile flag has only three possible variants: Domain, Public, and Private. -Profile标志只有三种可能的变体:Domain、Public 和 Private。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用命令行/ Powershell“关闭有关Windows备份的消息” - How to “Turn off messages about Windows Backup” using command line/ powershell Powershell - 如何使用Get-WindowsOptionalFeature命令“打开和关闭Windows功能” - Powershell - How to use Get-WindowsOptionalFeature command to “Turn Windows Features On and Off” 命令行-关闭密码保护的共享 - Command Line - Turn off Password protected sharing 即使在我完全关闭防火墙后,防火墙也不允许我的 python 客户端应用程序连接到我的机器上运行的服务器 - Firewall is not allowing my python client application to connect to a server running on my machine even after I turn off firewall completely 我无法通过 Powershell 关闭实时保护 - I can't turn off Real Time Protection via Powershell 有没有办法在PowerShell中关闭脚本解析并使用原始参数执行命令? - Is there a way to turn off script parsing in PowerShell and execute commands with raw arguments? Windows防火墙是打开还是关闭脚本 - is windows firewall on or off script 如何在 Python 中使用 Chrome 关闭 Selenium 中的命令行日志记录 - How to turn off command line logging in Selenium using Chrome in Python 是否有命令或API可以在Windows上打开/关闭wifi功能? - Is there a command or api can turn on/off wifi function on windows? 使用 Java 打开/关闭屏幕保护程序 - Turn on / off screensaver with Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM