01 May,2010 by Tom Collins
This script using Powershell , takes a list of SQL Servers , iterates through
the list and returns the results from the procedure : master.dbo.xp_fixeddrives.
Run this script as a standalone script or as part of a more comprehensive health monitoring snapshot
Depending on your security architecture , there may be a requirement to adjust the security method used to authenticate on the SQL Server
############START################# foreach ($svr in get-content "C:\MySQLServers.txt"){ $dt = new-object "System.Data.DataTable" $cn = new-object System.Data.SqlClient.SqlConnection > "server=$svr;database=master;Integrated Security=sspi" $cn.Open() $sql = $cn.CreateCommand() $svr $sql.CommandText = "EXEC master.dbo.xp_fixeddrives" $rdr = $sql.ExecuteReader() $dt.Load($rdr) $cn.Close() $dt | Format-Table -autosize } ##############FINISH########################
SQL Server Database Size and Free Disk Space Daily Report
SQL Server database free space with sys.dm_os_performance_counters
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |