The [run] section looks good (besides using the same name as an InnoSetup function) but not your code. It should look like:
[Code]
function GetDbServer(Default: String): String;
var
DBServer: String;
begin
result := '';
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\services\MA Service','DBServer', DBServer) then
begin
result := DBServer;
end;
end;
The corresponding [run] section:
[Run]
Filename: "{app}\Installdb.bat"; Parameters: {code:GetDbServer};
But it may be neccessary to add a
Check
condition to the Filename command to avoid executing it when the registry key is not found.