Show two rows in textbox without @{}

Im trying to output the following in a textbox

$name = Get-WmiObject ‘Win32_ComputerSystem’ -ComputerName localhost | select -property name
$bios = Get-WmiObject Win32_BIOS -ComputerName localhost | select serialnumber

$txtbox.Text = $name ; $bios

The result shows

How can i show the $bios in the same text box but in a second row and without @{name=}?

Eduardo, welcome to Please take a moment and read the very first post on top of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!.

When you post code or error messages or sample data or console output format it as code using the code tags “PRE”, please. Thanks in advance.

You have a few options to avoid this … maybe like this:

$name = Get-WmiObject ‘Win32_ComputerSystem’ -ComputerName localhost
$bios = Get-WmiObject Win32_BIOS -ComputerName localhost

$txtbox.Text = $($ ; $($bios.serialnumber)

or like this:

$name = Get-WmiObject 'Win32_ComputerSystem' -ComputerName localhost | Select-Object -ExpandProperty name
$bios = Get-WmiObject Win32_BIOS -ComputerName localhost | Select-Object -ExpandProperty serialnumber

$txtbox.Text = $name; $bios

BTW: Instead of Get-WmiObject you should use Get-CimInstance. :wink:
… and for the local computer you wouldn’t need to provide the parameter -ComputerName. :wink: