Hi,
Sure here’s the script, it’s very basic in terms of the calculating of the disk space, but it’s fine for our own needs. I’ve had to replace some hardcoded values of machine and user names with x’s but I think you should get an idea of what we are trying to achieve
Best Regards
import sys
import os
import re
import socket
import shutil
import math
mn = socket.gethostname()
total, used, free = shutil.disk_usage(“C:/”)
total=("%d" % (total // (230)))
used=("%d" % (used // (230)))
free=("%d" % (free // (2**30)))
c1 = int(free) / int(total)
c2=c1*100
c3 = math.trunc(c2)
p = 0
def alert(arg):
sys.stderr.write("%d%d%d" % (arg, arg, arg))
if c3 <= 34:
alert(1)
print()
if mn == ‘xxxxx_Laptop’:
print(“Trello Handle @xxxxx13”)
if mn == ‘xxxxx_Desktop’:
print(“Trello Handle @xxxxx7”)
if mn == ‘xxxxxx_Laptop’:
print(“Trello Handle @xxxxx2”)
if mn == ‘xxxx_Laptop’:
print(“Trello Handle @xxxxx4”)
if mn == ‘xxxx_Desktop’:
print(“Trello Handle @xxxxx4”)
if mn == ‘xxxxx_Laptop’:
print(“Trello Handle @xxxxx3”)
else:
pass
print()
print(“CRITICAL: Ransomware protection disabled on " + mn + " due to low disk space”)
print()
print(“CRITICAL: Windows Updates will not be Installed **”)
print()
print(“CRITICAL: Your SSD lifespan will dramatically reduce **”)
print()
print(“Please urgently free up disk space on your C: Drive (minimum 35%) to re-enable”)
print()
print(“Your Free Disk space is currently " + str(c3) + " Percent”)
p =1
else:
alert(0)