Share via

How can I add a user in active directory using PowerShell?

Zring Abdulrazzaq Rasool 20 Reputation points
2024-08-12T05:51:02.4733333+00:00

How can I add a user to a specific group in Active Directory for 35 days and then remove the user from the group using PowerShell?

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | PowerShell
0 comments No comments

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 132K Reputation points MVP Volunteer Moderator
    2024-08-12T05:58:20.3+00:00

    Hi @Zring Abdulrazzaq Rasool ,

    to add and remove users to and from on-premises Active Directory you can use these cmdlets in your script:

    Add-ADGroupMember

    Remove-ADGroupMember


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.