ForEach loop different in v2 and v3

Welcome Forums General PowerShell Q&A ForEach loop different in v2 and v3

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years, 7 months ago.

  • Author
    Posts
  • #5889

    Member
    Topics: 1562
    Replies: 0
    Points: 0
    Rank: Member

    by Pat Richard at 2013-05-09 16:24:17

    This works fine in v2:
    $feServers = Get-CsComputer -Pool $Pool | Sort identity
    # $feservers
    ForEach ($server in $feservers){
    Write-Host $server.identity -ForegroundColor yellow
    }

    but when running it on a machine with v3, I get no results. However, $feservers does have the same contents. It's just the foreach loop that's not returning the info.

    What am I missing?

The topic ‘ForEach loop different in v2 and v3’ is closed to new replies.