I'm working on a silent installer for OpenVPN as part of a bigger software package to be deployed on numerous Windows systems within my employer's corporate network.
I'm able to get OpenVPN to install silently using some command line options (stuff like /S /SELECT_SHORTCUTS=0 /SELECT_OPENVPN=1 /SELECT_SERVICE=1, etc). This works great.
However when it's done, it's assigned the TAP adapter to the Public Network location/profile:
I need the TAP adapter to be installed onto the Work network location/profile, so when I open up some ports on Windows' Advanced firewall (using some
netsh advfirewall firewall add commands) I can specify that traffic on these ports should only be allowed via network adapters on the Domain and Private profiles, not Public.
The installer is run with elevated privileges, so there are never any prompts or opportunities to pick the location/profile (i.e. Windows networking popups) during the install. Besides, I really don't want the guy running this installer to have any opportunities to muck around with it or make any changes--this is for internal use only and these settings are non-optional.
The bummer here, and the reason for my question, is I cannot figure out how to change the location/profile of the TAP adapter from the command line. There don't seem to be any
netsh commands to do it.
How can I change the location/profile of a Windows Network adapter from the command line? Something doable in a batch file would be preferred.
p.s. I am also using the steps described here to make the adapter not show up as an "unidentified network", which might be a pre-requisite for the above, not sure.