We create an Sql DB Bakup through application using the code below:
ServerConnection srvConn = new ServerConnection(HostName);
srvConn.LoginSecure = true;
Server srvSql = new Server(srvConn);
string FileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
+"//Closing Back-Up");
bkpDatabase.Database = database;
BackupDeviceItem bkpDevice = new BackupDeviceItem(FileName, DeviceType.File);
bkpDatabase.Devices.Add(bkpDevice);
bkpDatabase.SqlBackup(srvSql);
It works fine for Drives excluding the Drive where OS is installed due to right problems. In the drive with OS it says:Cannot open backup device. I searched it on internet and SO, but it suggests to manually change Built-In account from "Network Service" to "Local System" using SQL Server Configuration Manager.
But we distribute our software online and via CD's for self installation, so it is impossible to instruct each and every client to do so as they may not be technically well-versed with it.
So the question is, can we change the built-in account via Script ? Or is there any other solution that we can perform via program or script ?
Thank you.
Edit: We distribute SQL Server 2008 Express as a pre-requisite and downloaded from same folder as my application. The prerequisite doesn't ask for any account settings or instance-name etc settings, which we find in SQL Server manual installation procedure.