Before going to install MSSQLSERVER, I want to know whether MSSQLSERVER is already installed in the system or not. This should be done programatically in C++ or mfc.
If the MSSQLServer is already installed in the windows then Is there any possible way to get the MSSql Credentials of that server?
If So, Please Explain the way to achieve this?
UPDATE
I tried to install sqlserver 2005 and sql server 2008 in my system but both the servers are installed. I checked the registry path but It contains SOFTWARE\Microsoft\Microsoft SQL Server\90 for MSSQLServer 2005 and SOFTWARE\Microsoft\Microsoft SQL Server\100 for MSSqlServer 2008.Before installing my MSSQLServer How can I check whether any of the MSSql Server version is installed or not?
EDIT
Till Now I silent installed the SQLSERVER programmatically in c++.
I Posted the code below:
SHELLEXECUTEINFO ShExecInfo;
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = NULL;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = L"D:\\Softies\\SQLEXPR.EXE";
ShExecInfo.lpParameters = L"/qn addlocal=all InstanceName=SQLEXPRESS DisableNetworkProtocols=0 SECURITYMODE=SQL SAPWD=root SQLAUTOSTART=1 SQLBROWSERAUTOSTART=1 ENABLERANU=0";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_MAXIMIZE;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
int nResult=0;
nResult = (int )ShExecInfo.hInstApp;
if( nResult >32)
cout<<"EXE executed successfully"<<endl;
else
cout<<"Reason for failure is" <<nResult<<endl;
return 0;
BUT
If you’re a local administrator – you can start sql server from the command line with startup key -f and try to play with it – it is not guaranteed, but you can try.
I have a code which checks the some defaults for sql server instance, so it can be easily adopted to your needs and c++/