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

Dana Wirya 1 Reputation point


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


    Here are commands to enable and disable ad user accounts.
    For your reference:

    Then you can use gpp to deploy a task schedule for the computers ,following link for your reference:

    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