Enable and Disable AD Users in Daily Specific Time By Using Script

Dana Wirya 1 Reputation point
2021-02-25T08:12:48.033+00:00

Dears,

We have AD 2016 in our environment. We have some specific users we need to enable and disable their accounts started at 8:00 AM and Ended at 05:00 PM everyday. We need a script to perform this task by daily bases automatically not manually. Kindly do we have any script or group policy to do this job.

Best Regards,

Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,053 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Fan Fan 15,306 Reputation points Microsoft Vendor
    2021-02-26T05:02:06.68+00:00

    Hi,

    Here are commands to enable and disable ad user accounts.
    For your reference:
    https://www.lepide.com/how-to/unlock-enable-disable-ad-accounts-with-powershell.html

    Then you can use gpp to deploy a task schedule for the computers ,following link for your reference:
    https://www.faqforge.com/windows-server-2016/configure-scheduled-task-item-using-group-policy/

    This response contains a third-party link. We provide this link for easy reference. Microsoft cannot guarantee the validity of any information and content in this link.

    Best Regards,

    0 comments No comments