-
How to return 'Free Space' value?.....
Hi, I have linked to 50 servers and use dynamic query (exec @sqlString8000)...
to get info about 1000 databases.
Now I wand to use xp_cmdshell to check each server C:\ fress space, how could I return the last 2nd line value to a global ##temp table?
<<5 Dir(s) 2,169,880,576 bytes free>>
<<NULL>>
thanks
-D
-
The following should get you started :
create table #DirListing
(DirListingID int identity (1, 1),
Dirlist varchar (500))
Insert Into #DirListing
Exec Master..xp_cmdshell 'dir c:'
Insert Into ##Temp
Select DirList From #DirListing DL
Where DL.DirListingID = (Select Max (DL2.DirListingID) From #DirListing DL2) - 1
-
You can use sp_OACreate to get the drive information from FileSystemObject.
This one uses vbscript and WMI, but you can call it from t-sql using sp_oacreate.
http://www.microsoft.com/technet/scr...s_fsd_rrhv.asp
-
With this number of servers, better to use server management tool to monitor them.
-
it works...
It works. Stephen, good tip, especially by using the dirListingID = max - 1 to retrieve the last second line value.
thanks for all of you.
-D
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|