MaxKorban

New Member
Joined
May 15, 2013
Messages
2
Win7Pro Only

I'm looking for a scripted solution, or a command line that I can ultimately script. The reason being that I'm supporting 1200 users in remote locations, and I automate as much as I can in batch and VB scripts. I'm not intimately familiar with PowerShell, but I'm not opposed to it. I don't want to have to install updated versions of PowerShell on every PC I encounter, I just want to use what comes with Win7 SP1 natively. Hopefully this isn't a pipedream. :tongue:

I need to accomplish the following:
1. Set the network location to Work on all adapters.
2. Set the default location for a new connection to Work.

I've found some NETSH commands to tweak current profiles, but I haven't found anything to change the profile at large. I need it to be set to Work, not Home, not Public.

Any thoughts or suggestions would be greatly appreciated. :)
 


Solution
To achieve the network location settings you described on Windows 7 Pro using command line scripts that can be easily automated, you can leverage a combination of batch scripts and the built-in netsh command. Here's a breakdown of the steps you can follow:

Setting the Network Location to Work on All Adapters:​

You can use a batch script along with the netsh command to set the network location to "Work" on all adapters. Here's a sample batch script that accomplishes this:
Code:
@echo off REM Set the network location to Work for all adapters netsh advfirewall set currentprofile networklocationtype work REM Notify the user about the change echo Network location set to Work for all adapters. pause
Save this script with a .bat extension...
To achieve the network location settings you described on Windows 7 Pro using command line scripts that can be easily automated, you can leverage a combination of batch scripts and the built-in netsh command. Here's a breakdown of the steps you can follow:

Setting the Network Location to Work on All Adapters:​

You can use a batch script along with the netsh command to set the network location to "Work" on all adapters. Here's a sample batch script that accomplishes this:
Code:
@echo off REM Set the network location to Work for all adapters netsh advfirewall set currentprofile networklocationtype work REM Notify the user about the change echo Network location set to Work for all adapters. pause
Save this script with a .bat extension (e.g., network_location_work.bat) and run it on each PC to set the network location to "Work" for all adapters.

Setting the Default Location for a New Connection to Work:​

To set the default location for a new connection to "Work," you can configure the default profile settings. Here's a step-by-step guide to achieve this:
  1. Open an elevated command prompt.
  2. Use the following netsh commands to set the default location for new connections to "Work":
    Code:
    netsh advfirewall set global allprofiles firewallpreconfiguredconfiguration custom netsh advfirewall set publicprofile settings description "Work" netsh advfirewall set privateprofile settings description "Work" netsh advfirewall set domainprofile settings description "Work"

    Summary:​

    • Use a batch script with netsh commands to set the network location to "Work" for all adapters.
    • Configure the default profile settings using netsh commands to set the default location for a new connection to "Work."
    Remember to run batch scripts with administrative privileges to ensure the changes are applied successfully. These scripts utilize the built-in netsh command available natively in Windows 7 SP1, eliminating the need for additional installations. Feel free to test these scripts on a test machine first to ensure they meet your requirements before deploying them across the network. Let me know if you need further assistance or clarification!
 


Solution
Back
Top