LogMeIn Hamachi Offline After Logging Out From RDP

I’ve noticed this behavior for a while, and did some searching over the internet. I found this post from hamachi forum about how to prevent hamachi going offline when RDP session is logged out’

So as a workaround you can log off your RDP without closing the session creating a shourtcut in your desktop directed to “%windir%\System32\tscon.exe RDP-Tcp#0 /dest:console” and run as administrator. This will log you off and leave the session open. Just saying.

So far this solution seem to work for me, need to figure out what will happen when another user logs in into the PC.


Windows 7 Unable to Import Trusted Root Certification Authorities

Windows has its own trusted root CA certificates (which is also used by Google Chrome browsers). If your company is running your own internal CA, an additional CA certificate has to be added to it.

I encountered a very strange problem where everytime I import it via certmgr.msc the dialog says The import was successful but the certificate was never imported.

Solution 1: Use Administrator Elevated Privilege

  1. Click on windows icon -> Search for cmd
  2. Right click cmd.exe -> Run as Administrator
  3. From the command prompt, run certmgr.msc
  4. Continue with the import process

Solution 2: Edit Group Policy on Domain Controller

It is common for PCs in office environment to be connected to a network domain. The default domain policy is to disallow users from adding their own trusted root CA certificate.

To get around this problem, use group policy management editor on your domain controller and find **Certificate Path Validation Settings**. Update the settings into following:


See this Microsoft article for more info.

C++ min max Macro When Including Windows API

This is yet another quirks of C++ programming I found (and could be very hard to debug).

When you use Windows API (eg: you have #include <afxwin.h>), it will pull min() and max() macro.

Apparently this will cause confusion for the compiler if you’re including another 3rd party library which expects standard library min() and max(). The error message you get is something like this (how obscure is this?):

1>c:\mongodbsrc\src\mongo\db\../bson/bsonelement.h(630): warning C4003: not enough actual parameters for macro 'max'
1>c:\mongodbsrc\src\mongo\db\../bson/bsonelement.h(630): error C2589: '(' : illegal token on right side of '::'
1>c:\mongodbsrc\src\mongo\db\../bson/bsonelement.h(630): error C2059: syntax error : '::'
1>c:\mongodbsrc\src\mongo\db\../bson/bsonelement.h(630): error C2143: syntax error : missing ';' before '{'

To avoid pulling the macros from Windows API, hash define following:

#define NOMINMAX

Windows 7 nslookup Resolves But Ping And Others Failed

As a wannabe network admin at the office, I’ve been dealing with a really tricky problem for the past few days. Long story short, I have few development servers and I want to setup CNAMEs pointing to it so it’s easy to remember.

The problem is every 15-20min the CNAME will stop resolving. If I try to ping it gives name not found. However nslookup still resolves fine.

I’ve tried many different things with no luck until I finally found the problem: we mistakenly configured multiple public DNS on our DHCP settings alongside our primary internal DNS hosted on Windows Small Business Server 2011 (SBS). As shown below the configuration after we fixed it, only 1 entry is listed pointing to our internal DNS


It seems if multiple DNS servers are configured, windows will pick a primary one at random / round robin. If the primary happens to be the one other than our internal DNS, it won’t be able to resolve the CNAME entries.

This setting can be changed on DHCP configuration tool on SBS as shown below


And to make sure internet-wide name resolution still works. The public DNS have to be setup on the internal DNS forwarder on SBS DNS configuration


Add to the original confusion was I kept wondering why non CNAME alias still can be resolved all this time. This turns out due to the fact Windows uses not only DNS, but a set of other services to translate hostname into IP:

  1. Client check if the name queried is of its own
  2. Client checks local hosts file (eg: %Systemroot%\System32\Drivers\etc)
  3. DNS are queried
  4. NetBIOS

(Quoted from http://support.microsoft.com/kb/172218)

Notice that if DNS fails on step 3 regular PC names still can be resolved using NetBIOS, but in the case of CNAME it wouldn’t work.

How to Add Additional IP to Your Network Interface on Windows

This guide applies to Windows 7 and 8 but should be similar for older version of Windows. See here for similar guide on Mac OS X.

  1. Go to Control Panel > Network and Internet > Network and Sharing Center > Change Adapter Settings (on the left menu)
  2. Right click on the adapter you’d like to add IP to and select Properties (typically this is your primary network connection — eg: your LAN or wireless card)
  3. On the This connection uses following items selection, find Internet Protocol Version 4 (TCP/IPv4), select it and hit Properties
  4. Ensure your IP settings is manual (Use the following IP address and Use the following DNS server address radio buttons are selected). If it’s still automatic, change it and fill in your IP details. If you’re not sure what to fill, open command prompt and run the ipconfig /all command, this should show you your current network adapter config
  5. Once set to manual, click Advanced on the bottom right, and on the IP addresses area click Add. It will ask you for IP address and subnet mask. Again consult ipconfig /all command if you need to know. Typically you need to find an IP address which hasn’t been used on your network.