# power shell result in one line.

**URL:** <https://forums.powershell.org/t/power-shell-result-in-one-line/8274>\
**Category:** PowerShell Help\
**Created:** [March 22, 2017, 1:16pm UTC](https://forums.powershell.org/t/power-shell-result-in-one-line/8274 "2017-03-22T13:16:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe34](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@joe34](https://forums.powershell.org/u/joe34)\
**Post date:** [March 22, 2017, 1:16pm UTC](https://forums.powershell.org/t/power-shell-result-in-one-line/8274/1 "2017-03-22T13:16:57Z")

</div>

$computerSystem = Get-CimInstance CIM\_ComputerSystem  
$computerBIOS = Get-CimInstance CIM\_BIOSElement  
$computerOS = Get-CimInstance CIM\_OperatingSystem  
$computerCPU = Get-CimInstance CIM\_Processor  
$computerHDD = Get-CimInstance Win32\_LogicalDisk -Filter “DeviceID = ‘C:’”  
Clear-Host  
Hello, I am trying to have all the pc information in one line. What should I modify to get it in one line likened then save it as CSV.

Manufacturer, Model, Serial Number, CPU,HDD Capacity, HDD Space, etc…

Write-Host "System Information for: " $computerSystem.Name -BackgroundColor DarkCyan  
"Manufacturer: " + $computerSystem.Manufacturer  
"Model: " + $computerSystem.Model  
"Serial Number: " + $computerBIOS.SerialNumber  
"CPU: " + $computerCPU.Name  
"HDD Capacity: " + “{0:N2}” -f ($computerHDD.Size/1GB) + “GB”  
“HDD Space: " + “{0:P2}” -f ($computerHDD.FreeSpace/$computerHDD.Size) + " Free (” + “{0:N2}” -f ($computerHDD.FreeSpace/1GB) + “GB)”  
"RAM: " + “{0:N2}” -f ($computerSystem.TotalPhysicalMemory/1GB) + “GB”  
"Operating System: " + $computerOS.caption + ", Service Pack: " + $computerOS.ServicePackMajorVersion  
"User logged In: " + $computerSystem.UserName  
"Last Reboot: " + $computerOS.LastBootUpTime

if I run it i am getting it like:  
System Information for: pc-name  
Manufacturer: Dell Inc.  
Model: OptiPlex 7010  
Serial Number: 647ZXX1  
CPU: Intel(R) Core™ i5-3470 CPU @ 3.20GHz  
HDD Capacity: 146.39GB  
HDD Space: 6.15 % Free (9.00GB)  
RAM: 7.89GB  
Operating System: Microsoft Windows 7 Professional , Service Pack: 1  
User logged In:  
Last Reboot: 03/19/2017 08:16:21

---

<div class="post-metadata">

**Author:** ![sam-boutros](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/sam-boutros/32/5_2.png) [@sam-boutros](https://forums.powershell.org/u/sam-boutros)\
**Post date:** [March 22, 2017, 3:23pm UTC](https://forums.powershell.org/t/power-shell-result-in-one-line/8274/2 "2017-03-22T15:23:06Z")

</div>

Output your data as a PSObject not text. See [this script](https://gallery.technet.microsoft.com/scriptcenter/Powershell-Script-to-ping-15e0610a) as an example…

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:39pm UTC](https://forums.powershell.org/t/power-shell-result-in-one-line/8274/3 "2024-05-16T20:39:04Z")

</div>

Closed on May 16, 2024, 8:39pm UTC


