Showing posts with label tips and tricks. Show all posts
Showing posts with label tips and tricks. Show all posts

Thursday, July 02, 2009

Resetting the Offline Folders Database

If your Windows XP machine is trying to sync folders to a server that no longer exists, you can easily reset the Offline Folders database by adding a DWORD named FormatDatabase to HKLM\Software\Microsoft\Windows\CurrentVersion\NetCache, setting the value to 1, and rebooting the machine.

Friday, October 20, 2006

Network Configuration Profiles

Have you ever needed an easy way to switch between multiple network configurations? Are third party utilities too clumsy, limited or intrusive? The following article outlines an easy method that uses functionality already included with Windows.

As an network consultant and administrator, I have configured my laptop with my favorite tools for diagnosing problems and doing routine maintenance at various customers' sites. In order to use many of these tools, I often have to change my network configuration to work with the particular LAN I am connected to. Manually changing the relevant settings (IP address, DNS servers, Gateways etc.) turned out to be a time consuming process that I did not want to live with. After several unsuccessful searches for a pre-packaged solution, I decided to try and automate the process as much as I could using features already built into windows. I eventually found a solution using only the Netsh command and file associations.

Gathering Settings
The first step in creating network configuration profiles is to capture the settings for LAN you are connecting to. First I'll need to configure my network adapter with the appropriate TCP/IP settings and verify that they work. When I have verified that everything works, I can save my settings to a file by typing the following at a command prompt:

netsh -c interface dump > profile_name.ncp

Notice that I chose the extension .ncp for my configuration file - an extension that is not already in use on my system. This way I can configure windows to apply my saved settings using a simple file association. You are free to chose any extension you like, as long as it's not already associated to another program. You should perform this step for each different network configuration you plan to use.

Applying Saved Settings
In order to re-apply the settings to my system, I can type the following at a command prompt:

netsh exec profile_name.ncp

Netsh will apply all the settings in my previously saved configuration file to the system. Now I can easily apply different settings for each client network that I connect to.

Creating a File Association
Because I'm really lazy, I would like to simplify the previous step even more. I can do this by creating a simple file association in Windows. This will allow me to simply double-click the settings file and have the network adapter updated automatically. Here are the steps I need to take to do this:

  • Open Folder Options from the Control Panel and select the File Types tab
  • Click New to create a new entry and type NCP in the file extension box. Click OK to add the file type.
  • Under Registered file types, select NCP and click the Advanced button to edit the definition.
  • Optionally, enter a description of the file type (ex: Netsh Config File).
  • Optionally, change the icon for this file type to easily identify your configuration files.
  • Click New to create a new action and enter a name (ex: Apply Network Settings).
  • Enter the following text in the Application used to perform action box: "C:\WINDOWS\system32\netsh.exe" exec "%1"
  • Select the Use DDE checkbox and type netsh in the Application field and System in the Topic field.
  • Click OK to add the action.

That's it. Now a simple double click of the configuration file will apply the settings to my system. By repeating the last four steps above with some slight modifications (hint: use notepad.exe) I can easily add an Edit action to the right click menu of my configuration files - an exercise I will leave up to the reader.

Special thanks go out to Daniel Petri for his great article on Configuring TCP/IP from the Command Prompt.