Exporting a Powershell Script to CSV : I found a PowerShell script that looks to be just what I need, but I am having trouble pipeing it to a CSV.  I think it may be the Foreach portion that is giving the trouble, was wondering if anyone can pinpoint the cause.

$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "OU=Groups,DC=corp,DC=ourcompany,DC=Com" 
Foreach($G In $Groups)
{
    Write-Host $G.Name
    Write-Host "-------------"
    $G.Members
}

(Credit to Ryan Ries for posting in the first place)

Thanks!