Import-Module "SqlServer"
$fullsqlsrv='myservername.database.windows.net'
$sa='myadmin'
$sapwd='mypassword'
$connStr = "Server = $fullSqlSrv ; Database = master; User ID=$sa;Password=$sapwd"
$connection = New-Object Microsoft.SqlServer.Management.Common.ServerConnection
$connection.ConnectionString = $connStr
$connection.Connect()
$server = New-Object Microsoft.SqlServer.Management.Smo.Server($connection)
$allDBs= $server.Databases
foreach ($db in $alldbs){
if (!($db.tables.Name -contains 'cspCompany')) {"$($db.name) has no CSpCompany"}
}
$fullsqlsrv='myservername.database.windows.net'
$sa='myadmin'
$sapwd='mypassword'
$connStr = "Server = $fullSqlSrv ; Database = master; User ID=$sa;Password=$sapwd"
$connection = New-Object Microsoft.SqlServer.Management.Common.ServerConnection
$connection.ConnectionString = $connStr
$connection.Connect()
$server = New-Object Microsoft.SqlServer.Management.Smo.Server($connection)
$allDBs= $server.Databases
foreach ($db in $alldbs){
if (!($db.tables.Name -contains 'cspCompany')) {"$($db.name) has no CSpCompany"}
}
Comments
Post a Comment