title: format output of powershell script
body: <p>I have run the code below to gather information for all the machines on the network. </p>
  
  <pre><code>import-module activedirectory
  
  $getget = Get-ADComputer -Filter "OperatingSystem -like 'Windows 10 *'" - Property * | select name -ExpandProperty Name 
  
  
  echo $getget
  
  foreach ($new1 in $getget) {
  
  
  $bios = Get-WmiObject Win32_BIOS -ComputerName $new1
  $Proc = Get-WmiObject Win32_processor -ComputerName $new1
  $memory = Get-WmiObject Win32_physicalmemory -ComputerName $new1
  $system = Get-WmiObject Win32_ComputerSystem -ComputerName $new1
  $opera = Get-WmiObject win32_operatingsystem -ComputerName $new1
  $ip = [System.Net.Dns]::GetHostAddresses("$new1")
  $TotalSlots = (Get-WmiObject -Class "win32_PhysicalMemoryArray" - ComputerName $new1).MemoryDevices 
  
  
  $Object = New-Object PSObject -Property @{
  
  'OPerating system'     = $opera.Caption
  IP                     = $ip.IPAddressToString 
  UserName               = $system.UserName
  ComputerName           = $proc.SystemName
  Model                  = $system.Model
  'Serial Number'        = $bios.SerialNumber
  'Processor Name'       = $proc.name
  'RAM (GB)'             = ($system.TotalPhysicalMemory / 1GB -as [int])
  'Used RAM slot'        = $memory.count
  'Total RAM slot'       = $totalslots}
  
  Write-output $Object | Out-File "C:\web\.info.txt" -append
  ECHO $object
  }
  </code></pre>
  
  <p>The result is large text file with the format shown below, a block of text for each of the 100 odd machines on the network.</p>
  
  <pre><code>ComputerName     : MYMACHINE01
  Processor Name   : Intel(R) Core(TM) XXXXXXXXXXXX
  RAM (GB)         : 4
  UserName         : 
  IP               : xxx.xx.xxx.xxx
  Total RAM slot   : 4
  Used RAM slot    : 
  OPerating system : Microsoft Windows 
  Serial Number    : XXXXXXXXXXXX
  Model            : OptiPlex XXXXXXX
  
  
  ComputerName     : MACHINE02
  Processor Name   : Intel(R) Core(TM) XXXXXXXXXXX
  RAM (GB)         : 8
  UserName         : XXXXXXXXXXX\XXXXXXX
  IP               : XXX.XXX.XXX.XXX
  Total RAM slot   : 2
  Used RAM slot    : 2
  OPerating system : Microsoft Windows 
  Serial Number    : XXXXXXXXX
  Model            : OptiPlex XXXXXXX
  </code></pre>
  
  <p>How can i change the code so that the labels on the left become the column titles and each machine becomes a row? e.g:</p>
  
  <pre><code>ComputerName, Processor Name, RAM (GB), UserName,       IP,      Total RAM slot, Used RAM slot, OPerating system, Serial Number,   Model    
  
  MYMACHINE01   INTEL CORE      16        XXXXXXX  XXX.XXX.XXX.XXX       X                X         windows           XXXXXXXXX      XXXXX
  MACHINE02     XXXXXXXXX        8        XXXXXXX  XXX.XXX.XXX.XXX       X                X         windows           XXXXXXXXX      XXXXX
  </code></pre>
  
  <p>I have tried with format-table but i had no success, as a powershell beginner i'm probably missing something simple. Any help with this would be greatly appreciated.</p>
  
  <p>Thank you.</p>