AD Search Powershell

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

 

 

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! :wink:

1 Like

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/

1 Like

His name is probably Richard :slight_smile:

1 Like

[quote quote=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! :wink:

[/quote]
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

Click on the link I posted and read the help.

1 Like

my shell is refusing to run ADGroupMember and if i try to update my modules it get funny and confusing

Korede Kizzy,
Welcome to the forums.

Please do not hijack existing threads from other users. Instead you should create a new post for yourself and if needed post a link to the thread you’re refering to.

Thanks in advance.

Regardless of that - please keep in mind that we do not see your screen and we cannot read your mind. You should explain as detailed as possible what you want to know.