Powershell Studio help?

Right now I am learning Powershell Studio, so I have a basic code that has a Button plus a RichTextBox.


I am having trouble figuring out where I would need to insert my RichTextBox code so I can have the output display there.

Thanks for any help.

If you want the information to display in the rich text box as soon as you click on the button then the code to display the information in the text box should appear in the event for the button click for the button SystemInfo - $buttonSystemInfo_Click

I did have $RichTextBox.Text = $Object. Runs but nothing is displayed.

I tried the following chunk and it worked fine and showed up in my copy of studio

$buttonSystemInfo_Click = {
	#TODO: Place custom script here
	Import-Module Activedirectory
	$pc = Read-Host -Prompt " Enter Computer Name"
	$bios = Get-WmiObject Win32_BIOS -ComputerName $pc
	$networkResult = Get-WmiObject win32_networkadapterconfiguration -Filter 'ipenabled = "true"' -ComputerName $pc
	$Object = New-Object PSObject -Property @{
		'BIOS Version'	     = $bios.Version
		'Serial Number'	     = $bios.SerialNumber
		'MACAddress'		 = $networkResult.MACAddress
	$richtextbox1.text = $Object | Out-String

The formatting isn’t the nicest doing just out-string like that so i cleaned it up a little

$richtextbox1.Text = $object.psobject.properties | Where-Object{ $_.membertype -eq "noteproperty" } | ForEach-Object{
		"$($_.name) - $($_.value)`r`n"

Hey I appreciate the help. I was putting the code in the wrong line. It works, now I have to work on formatting it. Would format-table be better?

Not on my computer with studio but I imagine it would not be better off the top of my head. You can always test it out to see if its better as well