I am in charge of a group of computers that process highly confidential data. They cannot be connected to the Internet or even the company network, only a network drive. So I wrote a batch file on the network drive and run it on each computer to consistently apply security settings.
The batch file calls netsh exec
with the following script:
advfirewall
set store gpo = %COMPUTERNAME%
reset
set store local
reset
The problem is that the environment variable %COMPUTERNAME%
fails to resolve to the actual computer name, so the GPO is not reset and there are conflicts between the settings in the two locations. Furthermore, netsh advfirewall reset
only resets the local
store and set store
can only be run from a netsh script (the direct netsh advfirewall set store gpo
in the batch file does not work).
How do I get set store
to access the GPO for the machine that the batch file is running from? Or is there another way to reset the GPO settings (for Windows Firewall with Advanced Security) from the command line? I understand these settings are not stored in Registry.pol
.