I am using inno
setup to install SQL Server with Database
and Wildfly
in two different machines (Machine A and Machine B) in a network respectively.
As a first step, I install any one SQL Server (2012, 2014 or 2016 versions)
in Machine A.
In second step, I install Wildfly 10
in Machine B and during the installation I have a page where the user inputs the name of Database Server name, Database name and Instance name.
In order to verify the above entries, I have to validate that the Database name and Instance name is available in the Database server.
I was able to connect to the registry of the remote Machine B from Machine A to get the instance name installed using Power shell command with the below query
Invoke-Command -ComputerName MachineB -Command {Get-ItemProperty 'HKLM:\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL'}
However, I could not find the list of databases installed in the registry. Is there any way to get the list of databases available in the machine so that I can validate the same?
Sql Server does not store database names in the registry. Query sys.databases
for db names. Like so,
Invoke-Sqlcmd -ServerInstance myServer\myInstance -Query "select name from sys.databases"
In order to use Invoke-SqlCmd
on a system that doesn't have Sql Server installed, install Sql Server Powershell module to the local system.