Gui display unique names

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 10 months and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
Reddrgn2
Posts: 49
Last visit: Wed Nov 08, 2023 10:34 am
Answers: 1

Gui display unique names

Post by Reddrgn2 »

Product, version and build: studio - 2023 - v5.8.217
Operating system: win 11 or win 10
PowerShell version(s): 5.1

Trying to update a mini tool created to display AD (on prem) information for users. It's really basic, type in user name and displays, name, samaccount, employee id, employeenumber, extensionattribute1 few other things. Would like to change the naming of what is displayed, instead on the gui it says extensionattribute1 would like it to say positionID.

Below is the script used and photo of the gui, marked with what would like to change.
  1. $formGetEmpInfoFromDispla_Load={
  2.     #TODO: Initialize Form Controls here
  3.     #Import-Module ActiveDirectory
  4. }
  5.  
  6. $buttonFind_Click={
  7.     #TODO: Place custom script here
  8.     $displayname = $textboxdisplayname.Text
  9.     $labelDisplayUserInfo.Text = Get-ADUser -Filter "name -like '$displayname'" -Properties Name, SAMAccountName, Enabled, description, title, UserPrincipalName, employeeID, employeeNumber, extensionAttribute1, extensionAttribute2, ScriptPath, manager, SID, physicalDeliveryOfficeName | Format-List -Property Name, SAMAccountName, EmployeeID, Enabled, Description, Title, physicalDeliveryOfficeName, UserPrincipalName, ScriptPath, employeeNumber, extensionAttribute1, extensionAttribute2,manager, SID | Out-String
  10.    
  11. }
  12.  
  13. $buttonLoadADModule_Click={
  14.     #TODO: Place custom script here
  15.     Import-Module ActiveDirectory
  16.     $module = Import-Module ActiveDirectory -PassThru
  17.    
  18.     if (-not $module)
  19.     {
  20.         #Show error message
  21.     }
  22. }
2023-04-19_14-52-52.png
2023-04-19_14-52-52.png (33.25 KiB) Viewed 1956 times
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Gui display unique names

Post by brittneyr »

[Topic moved by moderator to PowerShell GUIs forum]
Brittney
SAPIEN Technologies, Inc.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Gui display unique names

Post by jvierra »

What you want cannot be done with a textbox except by programmatically editing the block of text. Use the "-replace on the "Text" property to replace any string.
User avatar
Reddrgn2
Posts: 49
Last visit: Wed Nov 08, 2023 10:34 am
Answers: 1

Re: Gui display unique names

Post by Reddrgn2 »

Any thoughts on how the coding might look, few tries don't do anything or cause error
User avatar
Domtar
Posts: 133
Last visit: Mon Mar 11, 2024 5:38 am
Has voted: 2 times

Re: Gui display unique names

Post by Domtar »

you can change the display like this (untested);

Format-List -Property Name, SAMAccountName, EmployeeID, Enabled, Description, Title, physicalDeliveryOfficeName, UserPrincipalName, ScriptPath, employeeNumber, @{ N = 'positionID'; E = { $_.extensionattribute1 } }, extensionAttribute2,manager, SID
This topic is 10 months and 1 week old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked