I have been getting mails to provide the whole code for reading Motherboard serial, so following are the header and source files for Visual C++.NET.

Header file:
#ifndef BIOS_H
#define BIOS_H
#using <mscorlib.dll>

#include "stdafx.h"
#define _WIN32_DCOM
#include <iostream>
#include <comdef.h>
#include <Wbemidl.h>

namespace MotherBoard
{
using namespace std;
class BIOS{
public:
_bstr_t RetrieveBIOSInfo();
private:
};
}
#endif


Source File:
#include "stdafx.h"
#include "bios.h"
#using <mscorlib.dll>



# pragma comment(lib, "wbemuuid.lib")


_COM_SMARTPTR_TYPEDEF(IWbemLocator, __uuidof(IWbemLocator));
_COM_SMARTPTR_TYPEDEF(IWbemServices, __uuidof(IWbemServices));
_COM_SMARTPTR_TYPEDEF(IWbemClassObject, __uuidof(IWbemClassObject));
_COM_SMARTPTR_TYPEDEF(IEnumWbemClassObject, __uuidof(IEnumWbemClassObject));

using namespace MotherBoard;
_bstr_t BIOS::RetrieveBIOSInfo()
{
_bstr_t bios;
HRESULT hres = S_OK;
// Initialize COM.
hres = CoInitializeEx(0, COINIT_MULTITHREADED);
if (FAILED(hres))
{
bios.operator =('none'); // Program has failed.
}

// Initialize
hres = CoInitializeSecurity(
NULL,
-1, // COM negotiates service
NULL, // Authentication services
NULL, // Reserved
RPC_C_AUTHN_LEVEL_DEFAULT, // authentication
RPC_C_IMP_LEVEL_IMPERSONATE, // Impersonation
NULL, // Authentication info
EOAC_NONE, // Additional capabilities
NULL // Reserved
);


if (FAILED(hres))
{
bios.operator =('none'); // Program has failed.
}

// Obtain the initial locator to Windows Management
// on a particular host computer.
IWbemLocatorPtr spLoc = NULL;

hres = CoCreateInstance(
CLSID_WbemLocator,
0,
CLSCTX_INPROC_SERVER,
IID_IWbemLocator, (LPVOID *) &spLoc);

if (FAILED(hres))
{
bios.operator =('none'); //Program has failed
}

IWbemServicesPtr spSvc = NULL;

// Connect to the root\cimv2 namespace with the
// current user and obtain pointer pSvc
// to make IWbemServices calls.

hres = spLoc->ConnectServer(

_bstr_t(L"ROOT\\CIMV2"), // WMI namespace
NULL, // User name
NULL, // User password
0, // Locale
NULL, // Security flags
0, // Authority
0, // Context object
&spSvc // IWbemServices proxy
);

if (FAILED(hres))
{
bios.operator =('none'); // Program has failed.
}

cout << "Connected to ROOT\\CIMV2 WMI namespace" << endl;

// Set the IWbemServices proxy so that impersonation
// of the user (client) occurs.
hres = CoSetProxyBlanket(

spSvc, // the proxy to set
RPC_C_AUTHN_WINNT, // authentication service
RPC_C_AUTHZ_NONE, // authorization service
NULL, // Server principal name
RPC_C_AUTHN_LEVEL_CALL, // authentication level
RPC_C_IMP_LEVEL_IMPERSONATE, // impersonation level
NULL, // client identity
EOAC_NONE // proxy capabilities
);

if (FAILED(hres))
{
bios.operator =('none'); // Program has failed.
}
IWbemClassObjectPtr spBaseBoard = NULL;
if( FAILED( hres = spSvc->GetObject(_bstr_t("Win32_BaseBoard.Tag=\"Base Board\""),
0,
NULL,
&spBaseBoard,
NULL)) )
{
bios.operator =('none');
}

variant_t v;
if( FAILED( hres = spBaseBoard->Get(bstr_t( L"SerialNumber" ), 0, &v, 0, 0)) )
{
bios.operator =('none');
}
bios = bstr_t(v);
return bios;
}