简体   繁体   中英

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.

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

I think your issue is with Get-NetFirewallProfile -profile Domain,Enabled . The -Profile flag has only three possible variants: Domain, Public, and Private.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM