I needed to configure a Windows 2012 R2 server for some services to test, but didn’t want to domain join it. By default, the network location was listed as public.
As such, firewall rules were not being followed.
To change the network location, open gpedit.msc (Local Group Policy Editor), and navigate to Computer Configuration / Windows Settings / Security Settings / Network List Manager Policies.
Double click the Network name of network that you would like to change the location.
Select the Network Location tab, and set the location to relevant setting.
Click OK, and close Local Group Policy Editor. The network location has now changed to the location you set.