Getting a script to write to variable text boxes.

Hi all,

I am in the process of creating a GUI for our service desk, and I am trying to get it to be all fancy and have different elements depending on the task they are trying to carry out.

Let’s say I have two Group Boxes, each with a set of text boxes.
I have one function, “Check-UserInfo”, which I would like to be able to receive inout from either of those group boxes.
The Click command is so:

$GUIFindButton.Add_Click({Check-UserInfo -USRName $GUIUsernameTextBox.text -ProgressBox $GUIProgressRichTextBox -UserNameBox $GUIUsernameTextBox})

And the function is so:

Function Check-UserInfo {
	Param (
	$ProgressBox.Text = "Cogitating...`n"
	$ProgressBox.Text += "Please stand by..."
	sleep -m 5
	IF (Get-Aduser -Filter {NAME -like $USRName})
		$USR = Get-Aduser -Filter {NAME -like $USRName} -Properties *
		$USR = Get-Aduser -Filter {SamAccountName -like $USRName} -Properties *
	IF (($USR|measure).Count -GT 0)
		$ProgressBox.Text = "Found $(($USR|Measure).count)...`nPlease stand by while useful information is collected and displayed..."
		ForEach ($User in $USR)
			$SamID = $User.SamAccountName
			$ProgressBox.Text += Get-RBUser $SamID | Out-String
	ELSEIF (($USR|measure).Count -LT 1)
		$ProgressBox.Text = "No such User.`nPlease Try again"

I gather that it is not happy about me trying to pass the name of my elements to it.
Is this even possible? I was looking at whether $This might be a solution, but it doesn’t seem like it.

Any help would be appreciated.

Since I can’t run your code, can you provide a bit more info on which line isn’t working, and what it isn’t doing that you want it to do?

Hi, thanks for the reply, I must have missed the email that told me I had a reply, sorry :-/


I ended up creating separate elements for each task, and I can’t actually remember now what it was I was trying to do here…