AD Search Powershell

Welcome Forums General PowerShell Q&A AD Search Powershell

Viewing 5 reply threads
  • Author
    Posts
    • #226017
      Participant
      Topics: 1
      Replies: 1
      Points: -5
      Rank: Member

      How to make a search bar in powershell , so that i can search the group name .

      Get-ADGroupMember -identity "GROUPNAME" -Recursive | Get-ADUser -Property DisplayName | Select Name,ObjectClass,DisplayName

       

       

    • #226047
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      Adv, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

      What do you mean with “search bar”? You could use Read-Host to prompt for the user to input some text.

      BTW: you choose a humble nickname! 😉

    • #226056
      Participant
      Topics: 12
      Replies: 1623
      Points: 2,565
      Helping Hand
      Rank: Community Hero

      Search bar is a GUI interface, there are two basic methods:

      Windows Form
      https://docs.microsoft.com/en-us/powershell/scripting/samples/creating-a-custom-input-box?view=powershell-7

      WPF
      https://adamtheautomator.com/build-powershell-gui/

      If you want to create a quick method to lookup groups, then you should look at Set-Alias to create a shorcut for your code. Something like this:

      Function Get-MyGroup ($name){Get-LocalGroup -Name $name}
      
      Set-Alias -Name gg -Value Get-MyGroup
      
      gg administrators
      

      If you want it to persist when you open sessions, then you can use a Powershell profile to have it set the alias every time you start a PS Session:

      https://www.howtogeek.com/50236/customizing-your-powershell-profile/

    • #226209
      Participant
      Topics: 6
      Replies: 93
      Points: 428
      Helping Hand
      Rank: Contributor

      His name is probably Richard 🙂

    • #226239
      Participant
      Topics: 1
      Replies: 1
      Points: -5
      Rank: Member

      Adv, welcome to Powershell.org. Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

      What do you mean with “search bar”? You could use Read-Host to prompt for the user to input some text.

      BTW: you choose a humble nickname! 😉

      Yes, you are right, that’s read host. How how can i add into this cmd below. When i open the powershell, it will appear ,

      ” please type in your group name” and i will automatically pop up the details .

      Get-ADGroupMember -identity "GROUPNAME" -Recursive | Get-ADUser -Property DisplayName | Select Name,ObjectClass,DisplayName
    • #226242
      Participant
      Topics: 4
      Replies: 2249
      Points: 5,494
      Helping Hand
      Rank: Community MVP

      How how can i add into this cmd below.

      Click on the link I posted and read the help.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.