Sorry for the late reply, I've only used this to set "Keep all connections", in which case the example above works well.
To switch between keep all and rematch, you need to set saveDataConns as well.
This json body is tested and works for me;
$rematch = @"
{
"uid" : "$gwuid",
"firewallSetting" : {
"fwKeepOldConns" : "False",
"saveDataConns" : "False"
}
}
"@
$keepall = @"
{
"uid" : "$gwuid",
"firewallSetting" : {
"fwKeepOldConns" : "True",
"saveDataConns" : "False"
}
}
"@
Remember to also call the /publish endpoint after setting the generic settings.