Quey user partial name & unlock account

Home Forums Scripting PowerShell Quey user partial name & unlock account

Viewing 1 post (of 1 total)
  • Author

  • confuseis

    Hi all
    Im looking to quickly unlock AD accounts. I want to enter in the partial name e.g. donald d
    have it return e.g.

    donald duck dduck locked
    donald donovan ddonovan disabled
    donald davids ddavids enabled

    Then choose e.g. donald duck to be unlocked

    So I need to list the relevant accounts including lockled accounts and quickly select the locked one.
    So far I have below. It dosent display locked accounts and I cant act upon the output.

    $name = read-host ‘Whats the name’
    Get-Aduser -Filter “name -like ‘$name*'” | select name,enabled | Format-List

    I have researched that Search-AdAccoount -lockedout can be used to look for unlocked accounts

    Need to bring it all together.

    The trick will be acting on the output. e.g. Select an account to be unlocked and the user would select 1 or 2

    1) donald duck dduck locked
    2) donald donovan ddonovan disabled

    If anyone has any pointers id be grateful



Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: