# IP address status with output to CSV

**URL:** <https://forums.powershell.org/t/ip-address-status-with-output-to-csv/25809>\
**Category:** PowerShell Help\
**Created:** [May 16, 2025, 12:01am UTC](https://forums.powershell.org/t/ip-address-status-with-output-to-csv/25809 "2025-05-16T00:01:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [May 16, 2025, 12:26am UTC](https://forums.powershell.org/t/ip-address-status-with-output-to-csv/25809/2 "2025-05-16T00:26:51Z")

</div>

AD1,  
Welcome to the forum. 👋🏼

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

[Guide to Posting Code - Redux](https://forums.powershell.org/t/guide-to-posting-code-redux/15797) \<---- Click 👆🏽 😉

( !! Sometimes the _preformatted text_ button hides behind the settings gear symbol. 😉 )

Your `$ipRange` will cause issues - you know that, right? 😏

```auto
$ipRange = 1..3
$subnet = '192.168.2.'
$Result = 
foreach ($i in $ipRange) {
    $ip = '{0}{1}' -f $subnet, $i
    [PSCustomObject]@{
        IP = $ip
        IsActive = Test-Connection -ComputerName $ip -Count 1 -Quiet
    }
}
$Result
$Result | 
    Export-Csv -Path .\NetworkScan.csv -NoTypeInformation

```

---

_[View the full topic](https://forums.powershell.org/t/ip-address-status-with-output-to-csv/25809)._
