WORKAROUND/SOLUTION
As you can imagine, there could be various methods to do this. Based on your choice, you can use any of the following methods.
1. Command prompt:
netsh -r RemoteComputerName -u Username -p Password -c advfirewall set allprofiles state off
2. PowerShell:
Invoke-Command -ComputerName RemoteComputerName -ScriptBlock {Set-NetFirewallProfile -Profile Public,Private,Domain -Enabled False}
3. PSExec:
To use this method, we need to download a tool from Microsoft site called as PsExec. Here is the link to download it.
psexec \\RemoteComputerName -u UserName -p Password netsh advfirewall set allprofiles state off
You can choose based on what scripting method you are using.
NOTE: above command will turn off the firewall for ALL profiles (i.e. Private Network, Domain Network and Public Network). If you are not OK with them then choose a proper profile (privateprofile, domainprofile or publicprofile)
Let me know if you know any other way to configure
Reference: Pinal Dave (https://blog.SQLAuthority.com)