Skip to content

Instantly share code, notes, and snippets.

@RDCH106
Created November 19, 2019 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RDCH106/e3079526d403c422e9790f6a4e8d7877 to your computer and use it in GitHub Desktop.
Save RDCH106/e3079526d403c422e9790f6a4e8d7877 to your computer and use it in GitHub Desktop.
Show free space for all logical disks
#!/usr/bin/env python
try:
import wmi
except ImportError as e:
print(e)
print("Please, install wmi package using 'pip install wmi'")
exit(-1)
c = wmi.WMI ()
for d in c.Win32_LogicalDisk():
print( d.Caption, str(round(int(d.FreeSpace) / 1073741824, 2)) + " GB")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment