power shell pop up window

Ilya Bokov 145 Reputation points
2024-08-22T10:38:40.35+00:00

hi everyone!

can somebody help me, to make ps1 script when it starts -

1 command:

$getusergroups = Get-ADUser -Identity (open popup window to put sAMAccountname) -Properties memberof | Select-Object -ExpandProperty memberof

where popupwindow - it need to put source sAMAccountname from active directory

and then $getusergroups | Add-ADGroupMember -Members targetsAMAccountname -verbose

thanks a lot

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,285 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
13,029 questions
Active Directory
Active Directory
A set of directory-based technologies included in Windows Server.
6,507 questions
Microsoft Exchange Online Management
Microsoft Exchange Online Management
Microsoft Exchange Online: A Microsoft email and calendaring hosted service.Management: The act or process of organizing, handling, directing or controlling something.
4,505 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,519 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 46,636 Reputation points
    2024-08-22T14:53:51.4866667+00:00

    Here's a brief example of doing that:

    Add-Type -AssemblyName Microsoft.VisualBasic
    
    $title = 'Account'
    $msg   = 'Enter the user account name:'
    
    $text = [Microsoft.VisualBasic.Interaction]::InputBox($msg, $title)
    If ($text){
        Get-LocalUser $text
    }
    Else {
        "Sorry"		# either no input from user or the "Cancel" button was used
    }
    
    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Ilya Bokov 145 Reputation points
    2024-08-23T06:08:06.18+00:00

    may be you can help, to make drop down menu from OU before $msg

    User's image

    SQLCopy

    Add-ADGroupMember -Identity $dropdownmenu_groups_from_OU_list -Members $msg
    
    0 comments No comments

  2. Ilya Bokov 145 Reputation points
    2024-08-27T05:58:34.39+00:00

    @Rich Matheisen can you help?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.