ISqlDatabasesComponentCopy link to this sectionLink to this section copied!

OverviewCopy link to this sectionLink to this section copied!

This interface is meant to configure SQL scripts, queries or SSRS reports, corresponding to the SQL Databases view:

Sql databases

The SqlDatabasesComponent has the following methods and properties:

Sqldatabasescomponent

MethodsCopy link to this sectionLink to this section copied!

  • DeleteDatabaseObject (Variant item) Deletes a database-related object. The item can be any of the objects returned by CustomConnections, PredefinedConnections, SQLiteConnections, SsrsDeployments, or browse/test operations.
  • NewBrowseDatabase (string name) -> ISqlDatabaseBrowse Creates a new database browse operation with the specified display name. Returns the created ISqlDatabaseBrowse.
  • NewBrowseServer (string name) -> ISqlServerBrowse Creates a new server browse operation with the specified display name. Returns the created ISqlServerBrowse.
  • NewCustomConnection (string name) -> ISqlCustomConnection Creates a new custom SQL connection with the specified display name. Returns the created ISqlCustomConnection.
  • NewPredefinedConnection (string name) -> ISqlPredefinedConnection Creates a new predefined SQL connection with the specified display name. Returns the created ISqlPredefinedConnection.
  • NewSQLiteConnection (string name) -> ISqliteConnection Creates a new SQLite connection with the specified display name. Returns the created ISqliteConnection.
  • NewSsrsDeployment (string name) -> ISqlSsrsDeployment Creates a new SQL Server Reporting Services (SSRS) deployment with the specified display name. Returns the created ISqlSsrsDeployment.
  • NewTestConnection (string name) -> ISqlTestConnection Creates a new SQL test connection with the specified display name. Returns the created ISqlTestConnection.

PropertiesCopy link to this sectionLink to this section copied!

  • BrowseDatabaseOperations (SAFEARRAY(Variant)) {get} Returns an array of ISqlDatabaseBrowse objects (database browse operations).
  • BrowseServerOperations (SAFEARRAY(Variant)) {get} Returns an array of ISqlServerBrowse objects (server browse operations).
  • CustomConnections (SAFEARRAY(Variant)) {get} Returns an array of ISqlCustomConnection objects.
  • ImpersonateUser (bool) {get}{set} Gets or sets whether SQL operations are impersonated under another user context.
  • PredefinedConnections (SAFEARRAY(Variant)) {get} Returns an array of ISqlPredefinedConnection objects.
  • SQLiteConnections (SAFEARRAY(Variant)) {get} Returns an array of ISqliteConnection objects.
  • SsrsDeployments (SAFEARRAY(Variant)) {get} Returns an array of ISqlSsrsDeployment objects.
  • TestConnectionOperations (SAFEARRAY(Variant)) {get} Returns an array of ISqlTestConnection objects.

Sample commandsCopy link to this sectionLink to this section copied!

# ISqlDatabasesComponent automation
$advinst  = New-Object -ComObject "AdvancedInstaller"
$project  = $advinst.CreateProject($advinst.ProjectTypes.Enterprise)

# Inspect available members
$project.SqlDatabasesComponent | gm

# Optional: run SQL operations under a specific user context
$project.SqlDatabasesComponent.ImpersonateUser = $true

# Create database objects
$browseDb   = $project.SqlDatabasesComponent.NewBrowseDatabase("Browse Database Connection")
$browseSrv  = $project.SqlDatabasesComponent.NewBrowseServer("Browse Server Connection")
$customConn = $project.SqlDatabasesComponent.NewCustomConnection("My Custom Connection")
$predefConn = $project.SqlDatabasesComponent.NewPredefinedConnection("SQL Server Predefined Connection")
$sqliteConn = $project.SqlDatabasesComponent.NewSQLiteConnection("My SQLite Connection")
$ssrs       = $project.SqlDatabasesComponent.NewSsrsDeployment("My SSRS Deployment")
$test1      = $project.SqlDatabasesComponent.NewTestConnection("Test Connection")
$test2      = $project.SqlDatabasesComponent.NewTestConnection("Another Test Connection")

# Access collections (for listing/iteration)
$project.SqlDatabasesComponent.BrowseDatabaseOperations
$project.SqlDatabasesComponent.BrowseServerOperations
$project.SqlDatabasesComponent.CustomConnections
$project.SqlDatabasesComponent.PredefinedConnections
$project.SqlDatabasesComponent.SQLiteConnections
$project.SqlDatabasesComponent.SsrsDeployments
$project.SqlDatabasesComponent.TestConnectionOperations

# Clean up: delete a specific object (pass the object reference)
$project.SqlDatabasesComponent.DeleteDatabaseObject($customConn)

$project.SaveAs("F:\cmdlet\output\DemoProj Enterprise - Databases.aip")
  

Topics