How to get Power Shell Output into excel file

Oct 24 2018 12:45 AM
Dear Team,
 
How can we get below script output into excel?
 
#Read CSV file
$CSV = Import-Csv "D:\Test\Sites.csv"
$SubSites = $CSV.Sites
$credential = Get-Credential
#Iterate through each site in subsite
Foreach ($Subsite in $SubSites)
{
#Inititate PnP Properties and get access request settings
Connect-PnPOnline -Url $Subsite -Credentials $credential
$Web = Get-PnPWeb
Write-Host "Site" $Web.Url -ForegroundColor Green
Get-PnPGroup -AssociatedOwnerGroup -ErrorAction SilentlyContinue
Get-PnPGroup -AssociatedMemberGroup -ErrorAction SilentlyContinue
Get-PnPGroup -AssociatedVisitorGroup -ErrorAction SilentlyContinue
}
 
Best regards

Answers (2)