Welcome › Forums › General PowerShell Q&A › AD Search Powershell
- This topic has 5 replies, 4 voices, and was last updated 8 months, 3 weeks ago by
Participant.
-
AuthorPosts
-
-
May 6, 2020 at 2:14 pm #226017
How to make a search bar in powershell , so that i can search the group name .
PowerShell1<span class="nb">Get-ADGroupMember</span> <span class="n">-identity</span> <span class="s2">"GROUPNAME"</span> <span class="n">-Recursive</span> <span class="p">|</span> <span class="nb">Get-ADUser</span> <span class="n">-Property</span> <span class="n">DisplayName</span> <span class="p">|</span> <span class="n">Select</span> <span class="n">Name</span><span class="p">,</span><span class="n">ObjectClass</span><span class="p">,</span><span class="n">DisplayName</span> -
May 6, 2020 at 2:41 pm #226047
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! 😉
-
May 6, 2020 at 2:54 pm #226056
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-7WPF
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:
PowerShell12345Function Get-MyGroup ($name){Get-LocalGroup -Name $name}Set-Alias -Name gg -Value Get-MyGroupgg administratorsIf 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/
-
May 6, 2020 at 10:01 pm #226209
His name is probably Richard 🙂
-
May 7, 2020 at 12:30 am #226239
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 .
PowerShell1<span class="nb">Get-ADGroupMember</span> <span class="n">-identity</span> <span class="s2">"GROUPNAME"</span> <span class="n">-Recursive</span> <span class="p">|</span> <span class="nb">Get-ADUser</span> <span class="n">-Property</span> <span class="n">DisplayName</span> <span class="p">|</span> <span class="n">Select</span> <span class="n">Name</span><span class="p">,</span><span class="n">ObjectClass</span><span class="p">,</span><span class="n">DisplayName</span> -
May 7, 2020 at 1:03 am #226242
How how can i add into this cmd below.
Click on the link I posted and read the help.
-
-
AuthorPosts
- The topic ‘AD Search Powershell’ is closed to new replies.