Show number separately

hello
i have somme difficulties to catch my screens serial number.

$i=0
 #find serial numbers

    $numSerie=gwmi -computerName $env:computername WmiMonitorID -Namespace root\wmi | ForEach-Object {($_.SerialNumberID -ne 0 | foreach {[char]$_}) -join ''} 

    write-host "serial numbers : $numSerie"
    write-host "number of screen : $($numSerie.Count)"
    write-host "value  i : $i"
    write-host "serial numbers : $($numSerie)"

    for($i=0;$i -lt $($numSerie.Count);$i++){   
        if(($($numSerie[$i]) -ne 0))
        { 
write-host "serial number :$($numSerie[$i]) "}


le variable $numSerie works well. But i have probleme to read each serial number separately. Syntax yet, how can i do ?

It looks like Mike Robbins wrote a function for this. I would give this a try, I tested it on my machine to ensure it works. Mike Robbins is a well known Powershell expert and I personally trust his code.

[PowerShell Gallery | Get-MrMonitorInfo.ps1 0.3.1](PowerShell Gallery | Get-MrMonitorInfo.ps1 0.3.1

thanks for the precious link !

i thinks i have an idea. I need use a foreach object, not a for loop, to do what i want.