I’m trying to make a GUI to make it easier for the help desk to remove multiple people from multiple groups. Please don’t get caught up in why i’m doing a GUI for this, i know it would be extremely easy to do this from the shell itself or a file or something.
I’m getting stuck. I’ve attached an image of my form, but i will also include the code. One field for users, another for the groups. I’m just trying to actually get the users/groups split by line break, and i’m having a hard time.
http://i.imgur.com/3mTA9bf.png
I’m trying to troubleshoot this issue with some basic code. I am trying to split what is in the $WPFtextbox.text by line break, using this code:
$WPFbutton.Add_Click({ $Users = ($WPFtextbox.text -replace "`r").split() foreach ($User in $Users) { Get-ADUser $User | select samaccountname } })
This is where it gets weird. If i enter in a user that doesn’t exist in Active Directory, ISE displays the standard “Cannot find object with identity: ‘testuser'” exception. However, if i put in a user i KNOW exists, nothing returns in the console window of ISE. Am i blatantly missing something? Full code is here: http://pastebin.com/NQrfTMdi
submitted by /u/MoneyMiddleton
[link] [comments]
The post Problem with GUI in powershell…never done this before appeared first on How to Code .NET.