[英]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.