Multi Server XP_fixeddrives

  • I have about 40 SQL Servers running as Targets to a Single Master. I have written a query to go to each of the targets and run the xp_fixeddrives stored procedure so that I can provide management with a report of the available disk space on each Server box. My Problem is I can't figure out how to attach the server name to the drive entries within a single table. Almost all of our servers have a c d and e drive, so I get 3 entries for each box. I know I can dump to a file and bring it back in, but I have to believe there is an easier way. Any suggestions would be much appreciated. I have listed what I have so far below.

    Thanks

    Declare @sname varchar(35)

    Declare sserver_cursor cursor for

    select siteserver from servername.sms_000.dbo.sites where sitetype<>1

    Open sserver_cursor

    Fetch Next from sserver_cursor into @sname

    While @@Fetch_status=0

    Begin

    Declare @spe varchar(45)

    set@spe=@sname+'.master.dbo.xp_fixeddrives'

    insert into Admin.dbo.drivespace

    exec @spe

    Fetch Next from sserver_cursor into @sname

    End

    Close sserver_cursor

    Deallocate sserver_cursor

  • Why not add a column to Admin.sbo.drivespace called "server". Change your insert to include the column list and exclude this column.

    then after the insert, update drivespace to set "server" = @sname where "server" is null (or = '')

    Steve Jones

    steve@dkranch.net

  • quote:


    Why not add a column to Admin.sbo.drivespace called "server". Change your insert to include the column list and exclude this column.

    then after the insert, update drivespace to set "server" = @sname where "server" is null (or = '')

    Steve Jones

    steve@dkranch.net


    Worked Perfect Steve...

    Thanks for your help. I may actually still have some hair by the end of the day.

  • Glad to help. Keep coming back and tell your friends.

    Steve Jones

    steve@dkranch.net

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply