Quantcast
Channel: Content tagged with "databases".
Viewing all articles
Browse latest Browse all 4

Get database object in PowerShell

$
0
0
Tags: databases powershell smo

This is a quick example on getting a attribute from a database in a given Databases collection.[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO')function Get-Database_Owner {param( [string]$SsdbName= $(throw'SQL Server database instance name is missing as a parameter.'), [string]$DatabaseName= $(throw'Database name is missing as a parameter.') ) $Ssdb=New-Object'Microsoft.SqlServer.Management.Smo.Server'$SsdbName $Ssdb.Databases["$DatabaseName"].Owner }A ex

Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>