SQL Write Disk Space to Table


/ Published in: SQL
Save to your folder(s)

This will run a bat file to get free space on a drive and write the results to a table.

Use script at http://snipplr.com/view/8331/calculate-free-space-on-drive/ as FreeSpace.bat


Copy this code and paste it in your HTML
  1. IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.tables WHERE TABLE_NAME = 'FreeSpace') DROP TABLE FreeSpace
  2.  
  3. CREATE TABLE FreeSpace ( SpaceInMB VARCHAR(100) NULL )
  4.  
  5. INSERT INTO FreeSpace EXEC master..xp_CMDShell 'C:\Scripts\FreeSpace.bat'

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.