Ran the below Script, not having much luck in getting all the output seen on the Screen into a File. Any help, greatly appreciated. Thanks.
$OUS = Get-ADOrganizationalUnit -Filter {name -like "*"} | select -expandproperty distinguishednameforeach ($OU in $OUS){
$counter = 0
$gpos = Get-GPInheritance -target "$OU" |select -ExpandProperty inheritedgpolinks
foreach ($gpo in $gpos){
$counter++
$gponame = $gpo.displayname
"$counter","$gponame","$OU"
}
}