[Local User Owner], the rule with Hostname/Administrator is still in Enable. I want change to Disable from EC2 UserData

  amazon-ec2, windows

I am building a server using an AWS EC2 instance.
I’m having trouble setting up a Firewall for Windows OS.

I use AWS SG, but I also need to configure the OS Firewall.

I want to achieve the following behavior.

1. disable Domain, Public, Private
Set-NetFirewallProfile -Profile Private,Public,Domain -Enabled false
2. disable all rules that exist
NETSH ADVFIREWALL FIREWALL SET RULE all NEW enable=no 3.
Create a new Inbond rule. 3.
3. enable Domain, Public, Privavte

Sign in to the Windows OS, tap the command directly into Powershell and I get the results I expect.

However, if I build it in EC2 UserData as command.

[Local User Owner], the rule with Hostname/Administrator is still in Enable. It is not disabled.

The reason and solution for it I would like to know.

Can someone please help me? Thank you.

Source: Windows Questions

LEAVE A COMMENT