Need Help Disabling Windows Firewall Profiles via PowerShell for Ansible Automation
Ambika Singh
0
Reputation points
We have a requirement to set Windows Firewall profiles to "off" using Ansible Automation. Despite various attempts, the profiles reset/enabling upon reboot due to Group Policies. I am not able to disable the windows firewall profiles through Powershell or Registry Keys as on rebooting GroupPolicies are taking over and resetting/enabling the Domain, Public and Private Profiles. This is a required step to work with Ansible automation.
Tried the following methods:
PowerShell:
-
Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
-
%ProgramFiles%\Windows Defender\MpCmdRun.exe -wdenable
- `Set-GPRegistryValue -Name "Firewall Domain Profile" -Key "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\DomainProfile" -ValueName "EnableFirewall" -Type DWORD -Value 0` - `Set-GPRegistryValue -Name "Firewall Private Profile" -Key "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\PrivateProfile" -ValueName "EnableFirewall" -Type DWORD -Value 0` - `Set-GPRegistryValue -Name "Firewall Public Profile" -Key "HKLM:\SOFTWARE\Policies\Microsoft\WindowsFirewall\PublicProfile" -ValueName "EnableFirewall" -Type DWORD -Value 0`
-
- Ansible Module:
-
win_firewall:
-
state: disabled
-
profiles:
- `Domain` - `Private` - `Public`
-
Sign in to answer