Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell GUI Popup Box - Line Break

$
0
0

Building a GUI (IT Helpdesk Tool) to do daily tasks. One part is to grab computer information.

I have the drop down displaying a list of all the computers.  On the "Get Computer Info" Button - it does a WMI query to get all of the computer info that I have requested.  Question I have it is on the message box that displays the info - how do I line break to a new line?

I have a little work to do on what information I am pulling, but want to get the formatting working correctly first.

In short - how do I line break on a MessageBox?

Thanks

	$buttonComputerInfo_Click = {
		$computer = $dropdown2.Text
			if ([string]::IsNullOrEmpty($computer) -eq $false){
                [string]$computer
				$colItems = get-wmiobject -class "Win32_ComputerSystem" -namespace "root\CIMV2" -computername $computer

				foreach ($objItem in $colItems){
					$displayGB = [math]::round($objItem.TotalPhysicalMemory/1024/1024/1024, 0)
					#write-host "Total Physical Memory: " $displayGB "GB"
					#write-host "Model: " $objItem.Model
				}

				$colItems2 = get-wmiobject -class "Win32_Processor" -namespace "root\CIMV2" -computername $computer
				foreach ($objItem in $colItems2){
				#write-host "System Name: " $objItem.SystemName
				}
				[System.Windows.Forms.MessageBox]::Show("System Name:  $Computer Memory: $displayGB GB Model: $objItem.Model")
			}
			else {
            	[System.Windows.Forms.MessageBox]::Show("The Computer Name field is empty.  Select a computer from the drop down.")
           }
    }


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>