Forum / Remote Desktop Manager - PowerShell Repository

Create Database with PowerShell

  • Create an Issue
  • Cancel

Hello,
is there a way to create a SQL-Database within the PowerShell-Context?

Basically I'm searching for the button "Datenbank erstellen" or "Create database" in a programatically way:
image

Thanks and Kind Regards
Bünyamin Olgun

Clock3 yrs

I think you can use the New-RDMDatasource cmdlet for the RDM PowerShell module. Try using Get-Help New-RDMDatasource -full for detailed info on using this cmdlet. What might help you figure some of it out is to create a SQL datasource and then use Get-RDMDatasource and look at some of the properties from that output.

Clock3 yrs

Thanks for your answer.

Afaik New-RDMDataSource does only create a data source which is actually only a connection to an already existing database.

I did try using Get-Help but didn't find any helpful parameters for creating such a database.

Clock3 yrs

Hi,

The creation and update of a database in a SQL Server data source with the PowerShell module is not supported.

We will add this in our TODO list.

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs

Hi,

We added Invoke-RDMCreateDataSourceDatabase and Invoke-RDMUpdateDataSourceDatabase cmdlets in the PowerShell module.

Invoke-RDMCreateDataSourceDatabase is to create a database.

Ex:

$ds = New-RDMDataSource -SQLServer -Database "DatabaseName" -Name "DataSourceName" -Server "localhost" -Username "username" -Password (ConvertTo-SecureString 'password' –asplaintext –force)
Invoke-RDMCreateDataSourceDatabase -DataSource $ds

Invoke-RDMUpdateDataSourceDatabase is to update a database.

They will be available in the next RDM version.

Best regards,

Olivier Désalliers

signaturesignature

Clock3 yrs