param(
	[string]$dataSource,
	[string]$database,
	[string]$login,
	[string]$pwd
)

try {
	$connection = New-Object -TypeName System.Data.SqlClient.SqlConnection
	$connection.ConnectionString = "Data Source=" + $dataSource + ";UID=" + $login + ";PWD=" + $pwd + ";Connection Timeout=30;Database=" + $database;
	$command = $connection.CreateCommand()
	$command.CommandText = "SELECT name FROM sysobjects WHERE OBJECTPROPERTY(ID,N'IsTable')=1 and OBJECTPROPERTY(ID,N'IsMSShipped')=0" 
	$adapter = New-Object -TypeName System.Data.SqlClient.SqlDataAdapter $command
	$dataset = New-Object -TypeName System.Data.DataSet
	$adapter.Fill($dataset) > $null
	$table = $dataset.Tables[0]
	$firstColumn = $table.Columns[0]
	foreach ($row in $table.Rows) {
		Write-Host $row[$firstColumn]
	}
} catch [Exception] {
	Write-Host $_.Exception.Message
	exit 1
}

