Forum Discussion
Script that disable AD User Account after Login Hours expires
Hi guys,
I looking for a powershell script that disable AD User Account after Login Hours expires!!!
The idea is configure a task to run this script each 5 minutes.
Any idea?? Is it possible to do that?
Thanks
Diogo
- AndySvintsSteel Contributor
Hello dmello30,
Can you please elaborate? What are you trying to accomplish?
Please describe your use case.
Logon hours attribute restrict the time that user is allowed to login to domain.
You want to disable user after logon hours and then enable it back again during the logon hours?
Thank you.
- dmello30Copper Contributor
Hello AndySvints
Exactly.
I want disable user after logon hours and then enable it back again during the logon hours.
Thanks
Diogo- farismalaebSteel Contributor
Forgot to add the link
Check it out
http://kb.delborrell.net/2018/06/22/deploy-logon-hours-via-powershell/
- farismalaebSteel Contributor
Hi,
I dont know why you might need to do such a change, as once the logon hour are not applicable, the user wont be able to login.
Anyway Check this script that can take you though