简体   繁体   中英

Powershell GUI Issue

I am trying to write a Powershell script to create a GUI where you can input the username and it will print all the AD groups that user is a part of.

Function Get-MemberOf {
    $user = Read-Host -Prompt 'Enter username'
        
    $groups = (Get-ADUser $user  -Properties MemberOf).memberof | Get-ADGroup | Select-Object name 
}

I have got this far but stuck on the actual GUI section.

Any help appreciated

Thank you @marsze & @jdweng for your suggestion, Posting the same in community wiki with my findings as well so that it will be beneficial for other community members.

Agreed with the suggestion,

If you create scripts, avoid creating a GUI. Keep it in the shell; it is much shorter. If you mark something as mandatory, Powershell will automatically ask for input and even validate it for you.

For more information please refer this SO THREAD | PowerShell Script to display all users part of AD security groups within an OU in AD .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM