Script that disable AD User Account after Login Hours expires

Copper Contributor

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

4 Replies

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.

@dmello30 

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 

Hello @AndySvints 

 

Exactly. 

I want disable user after logon hours and then enable it back again during the logon hours.

 

Thanks


Diogo