Posts

Showing posts from November, 2012

Get SQL Server free disk information without admin privileges

Following script will get the free disk space in database server. To run this script following permissions are required. " NO sysadmin " privileges are required. Permissions Required GRANT execute on sp_OAGetErrorInfo to UuerUser GRANT execute on sp_OAGetProperty to UuerUser GRANT execute on sp_OACreate to UuerUser GRANT execute on sp_OADestroy to UuerUser Script declare @RunLocal bit = 1; DECLARE @DiskSpaceStats TABLE ( DriveLetter char(1), TotalSize decimal(20,0), AvailableBytes decimal(20,0), DriveType char(10), PercentFree decimal(18,3), Report_Date datetime default getdate() ) DECLARE @DiskSpace TABLE ( RowID int Identity Primary Key, DriveLetter char(1), TotalSize decimal(20,0), AvailableBytes decimal(20,0), DriveType char(10), PercentFree decimal(18,3) ) DECLARE @counter int DECLARE @FSOobject int DECLARE @RecordCount int DECLARE @count int DECLARE @string  char(35) DECLARE @DriveLetter char(1) DECLARE @Tota