anlai / Permitted-Logon-Times-for-Active-Directory

5 stars 2 forks source link

My LogOn Hour is last hour of the day #3

Open faheemsial opened 6 years ago

faheemsial commented 6 years ago

Consider logon hour "Sunday from 11:00 PM to 12:00 AM" when i add this value in LogonHours list as:

var newTest = new List<ADPermittedLogonTime.LogonTime>(); var zone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); newTest.Add(new ADPermittedLogonTime.LogonTime(DayOfWeek.Sunday, new DateTime(2011, 1, 1, 23, 0, 0), new DateTime(2011, 1, 1, 0, 0, 0), zone)); whole calculation got messed up with this interval. can u plz try with this time interval?

faheemsial commented 6 years ago

in first attempt it gave error: "Begin time cannot be after End time." i changed this error validation as following: if (EndTime.Hour < BeginTime.Hour && (EndTime.Hour != 0 && EndTime.Day == BeginTime.Day)) { throw new ArgumentException("Begin time cannot be after End time."); }

in 2nd attempt after that change it converts list into masked byte array but when i convert it back to LogonTime list it doesn't generates any result for this mentioned hour. it seems it skipped this 23rd hour while generating mask.

juliermefelix commented 3 years ago

Dear, I need to view the schedule that is registered in the AD to then make the change I'm using: var newResult = PermittedLogonTimes.GetLogonTimes (m_Bytes1)

But it is not bringing. Can someone help me.