Skip to content

Instantly share code, notes, and snippets.

@icheko
Created July 9, 2014 16:09
Show Gist options
  • Save icheko/32b76c44064aeba3ae79 to your computer and use it in GitHub Desktop.
Save icheko/32b76c44064aeba3ae79 to your computer and use it in GitHub Desktop.
VBScript write free disk space to file
Const ForAppending = 8
Set objWMIService = GetObject("winmgmts:")
Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.DeviceID='s:'")
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.OpenTextFile("c:\DAS_free_space.txt", ForAppending, True)
objFile.WriteLine(FormatNumber((CDbl(objLogicalDisk.FreeSpace)/1024/1024/1024)) & ",")
objFile.Close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment