# Need help for this report!

**URL:** <https://forums.powershell.org/t/need-help-for-this-report/19870>\
**Category:** PowerShell Help\
**Created:** [July 12, 2022, 3:16pm UTC](https://forums.powershell.org/t/need-help-for-this-report/19870 "2022-07-12T15:16:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sfjmercado](https://avatars.discourse-cdn.com/v4/letter/s/f04885/32.png) [@sfjmercado](https://forums.powershell.org/u/sfjmercado)\
**Post date:** [July 12, 2022, 3:16pm UTC](https://forums.powershell.org/t/need-help-for-this-report/19870/1 "2022-07-12T15:16:41Z")

</div>

I have the following script and it does well to give me systems that are online, and the reboot date/time:

#TYPE Selected.System.Management.ManagementObject  
“csname”,“LastBootUpTime”  
“LSLPC1762”,“6/10/2022 5:29:26 PM”  
“LSLPC1994”,“7/11/2022 4:03:07 PM”  
“LSLPC1743”,“6/14/2022 7:23:31 AM”  
“LSLPC1802”,“6/29/2022 6:46:21 PM”

However, I would like to also list the systems that do not ping in the CSV report as well, such as “offline”. How do I do this?

Script:

`Preformatted text`  
$machines = Get-Content “C:\Users\lslmea0\Desktop\Machine\_List.txt”  
$report = @()  
$object = @()  
foreach($machine in $machines)  
{  
$machine  
if (Test-Connection -ComputerName $machine -Quiet -Count 1) {  
$object = gwmi win32\_operatingsystem -ComputerName $machine | select csname, @{LABEL=‘LastBootUpTime’;EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}}  
$report += $object  
} else {  
Write-Host “$machine is offline. Skipping…”

```
    }
    }

```

$report | Export-csv “C:\Users\lslmea0\Desktop\Reboot.csv”

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [July 12, 2022, 3:28pm UTC](https://forums.powershell.org/t/need-help-for-this-report/19870/2 "2022-07-12T15:28:55Z")

</div>

Frederick,  
Welcome to the forum. 👋🏽

Before we proceed … please go back and fix the formatting of your question.

When you post code, sample data, console output or error messages please format it as code using the _preformatted text_ button ( **\</\>** ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

[How to format code in PowerShell.org](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/b/bee50c628238f2c076c0504efb6b15f2fb11f002.gif) \<---- Click 👆🏽 😉

---

<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:17pm UTC](https://forums.powershell.org/t/need-help-for-this-report/19870/3 "2024-05-16T20:17:43Z")

</div>

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


