Link to home
Start Free TrialLog in
Avatar of Mirceyhun Musayev
Mirceyhun Musayev

asked on

Exporting script output to csv

Hi, i have script for get all groups that a user is member of. Works correctly, but  i cant export it to csv file. output shows PS terminal just. any ideas what i exactly must  add to script?

 

Import-Module ActiveDirectory
Get-ADUser -SearchBase "OU=Users,DC=domain,DC=local" -Filter * | foreach-object {
write-host "User:" $_.Name -foreground green
    Get-ADPrincipalGroupMembership $_.SamAccountName | foreach-object {
        write-host "Member Of:" $_.name
    }
}
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mirceyhun Musayev
Mirceyhun Musayev

ASKER

Thank you, it works