I need to add SQL Server to the firewall with both Private and Public checked. Ive been trying to mess around with the firewall profile but there doesnt seem to be an option to set it to both.
Dim ruleSQL As INetFwAuthorizedApplication = CreateObject("HNetCfg.FwAuthorizedApplication")
ruleSQL.Name = "12 SQL Test"
ruleSQL.IpVersion = NET_FW_IP_VERSION_.NET_FW_IP_VERSION_ANY
ruleSQL.ProcessImageFileName = "C:\Program Files\Microsoft SQL Server\MSSQL15.EDGESQL2019\MSSQL\Binn\sqlservr.exe"
ruleSQL.Scope = 0
ruleSQL.Enabled = True
Dim firewall As INetFwMgr = CreateObject("HNetCfg.FwMgr")
Dim tfwpolicy As INetFwPolicy = firewall.LocalPolicy
Dim ppolicy As INetFwProfile = tfwpolicy.GetProfileByType(NET_FW_PROFILE_TYPE_.NET_FW_PROFILE_STANDARD)
ppolicy.AuthorizedApplications.Add(ruleSQL)