import os
import subprocess
import datetime
import time


while True:
    if not os.path.isdir("Z:"):
        print("Volume not Found")
        subprocess.call("net use Z: \\\\200.1.2.3\lan /user:123", shell=True)
        with open("zls_check.txt", "a") as datei:
            datei.writelines(f"Volume not Found {datetime.datetime.now()} - User: {os.getlogin()}" + "\n")
    else:
        with open("zls_check.txt", "a") as datei:
            datei.writelines(f"Volume Found - {datetime.datetime.now()} - User: {os.getlogin()}" + "\n")
    time.sleep(60)