Introduction The Windows 7 login script I inherited Tools Flow Chart Requirements Auto Login Auto Shutdown Unix Timestamps Design Auto Login Auto Shutdown Conclusion
The Windows 7 login script I inherited Displays a login screen Performs account authentication Checks for blank usernames and passwords less than 8 characters Auto login capability does not work. Auto login implemented using threading.
Threading Thread A Thread BThread C
Tools Python Eclipse
Shutdown the computer at any scheduled time
Create a 2 GB H: drive partition Run login.vbs Run LibraryDefaultPage.vbs Display desktop
Number of seconds since 12 a.m. Jan. 1, 1970 E.g. 5/3/2013 5:54:17 PM
Problem 1: time is not a Unix timestamp ['11:20', '']
Solution: Step 1: Get the month, day, year now datetime.datetime.now() month day year str(now.month) str(now.day) str(now.year)
Step 2: Get the hour, minute, second hour,minute = shutdownTimeList[0].split(‘:’) 11:20 hour = 11 minute = 20 second = “00”
Step 3: Make a date string e.g. mm/dd/YYYY HH:MM:SS Step 4: Make a timestamp Time.mktime.datetime.datetime.strp time(date_string, “%m/%d/%Y %H:%M:%S”) e.g
Threading abandoned Therefore: shutdown –a: cancels shutdown/restart shutdown –r –t xxx: sets restart for xxx seconds [' ', ' ', ' ', '']
now Auto Login Start Time Auto Login Period Auto Login End Time Outside Auto Login Period restart 60 sec. after auto login period time.time() os.system(“shutdown –r –t xxx”) clear any restart/shutdown create 2 GB partition for H: call login.vbs with auto login credentials call LibraryDefaultPage.vbs
now restart 60 sec. after auto login period clear any restart/shutdown create 2 GB partition for H: call login.vbs with auto login credentials call LibraryDefaultPage.vbs os.system(“shutdown –a”) subprocess.call(“diskpart /s command.txt”) shell.Run(“wscript.exe [file path]”)
Problem: Multiple auto login times Auto Login Start Time Auto Login Period Auto Login End Time Outside Auto Login Period now
Solution: Boolean flag Auto Login Start Time Auto Login Period Auto Login End Time Outside Auto Login Period now flag
Problem: auto login after auto shutdown Auto Login Start Time Auto Login Period Auto Login End Time Outside Auto Login Period nowauto shutdown flag
Solution: global variable autoShutdowntime Auto Login Start Time Auto Login Period Auto Login End Time Outside Auto Login Period nowauto shutdown
Summary Auto Login Start Time Auto Login Period Auto Login End Time Outside Auto Login Period nowauto shutdown set flag to true os.system(“shutdown –a”) os.system(“shutdown –r –t xxx”)
hour, minute = shutdownTimes[0].split(':') dateString = month + "/" + day + "/" + year + " " + hour + ":" + minute + ":" + second time.mktime(datetime.datetime.strpt ime(dateString, "%m/%d/%Y %H:%M:%S").timetuple())
(urllib2.urlopen(" + bootserver + "/getentityvarval?var=parameter").read()).split('\r\n')
Why it needs to be improved Switch Digital Classroom to Windows 7 Reduce power consumption Expired and webcat accounts can log in.