Tag: Database Size

  • Powershell Function to Get Sizes of All Databases on an Instance

    Below is a function that I modified from one in Idera’s SQL Server Powershell Scripts toolset: [sourcecode language=”powershell”] #Function to get sizes of all DB’s hosted on an instance Function Get-SQLDBSizes { param ( [string]$InstaceName = "$(Read-Host ‘Please use format ServerName(IPAddress)\InstanceName’ [e.g. 127.0.0.1\instance])" ) begin { [void][reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") } process { try { Write-Verbose "Connect to…