How to make the openvpn a network trusted on windows 10?

Due to certain features on the laptop the windows firewall severely limited the access of applications to public networks. I use openvpn and have noticed the following situation - when reconnecting to the server, the connection becomes public
5e4b82e9c3445907719825.png
Accounts from the console, edit the network type, but it helps only to restart the connection..
How to make the connection has always been private? The gugleniya on tap to set openvpn private network leads to https://forums.openvpn.net/viewtopic.php?t=20570 where suggest to add a default route, but my profile is not suitable.
April 7th 20 at 15:37
1 answer
April 7th 20 at 15:39
Solution
Have OpenVPN has the ability to run scripts after the lifting of the tunnel (up) and off (down). Just write a script and stick to the config, like this:

up /path/to/up_script
down /path/to/down_script

Thus, if falls off the network and the settings are not saved, then when reconnecting OpenVPN itself pulls the script and making the network private. Another issue is that we must somehow figure out the interface index, but it is the specifics of the Windows, then I will not help

Another note on setting script-security and immediately set it to 2, i.e. add a config line
script-security 2
Probably it will be the decision of the house to smoke as a regular season to get the connection id from the output
Get-NetConnectionProfile - Kirstin.Hegma commented on April 7th 20 at 15:42
in the configuration I added
script-security 2
up 'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -ExecutionPolicy Bypass-File setPrivate.ps1'


The script here is a
Get-NetConnectionProfile -InterfaceAlias $args[0] | Set-NetConnectionProfile -NetworkCategory Private
- Kirstin.Hegma commented on April 7th 20 at 15:45
Don't know whether it affected the result, but I renamed both the openvpn connection (adapter) through the control center network and sharing - Kirstin.Hegma commented on April 7th 20 at 15:48

Find more questions by tags OpenVPNWindows