Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Export to CSV file from script

$
0
0

I am trying to run the following script which is a PS1 file and I need to direct the output to a CSV file -

Get-ADUser-SearchBase"OU=Name,OU=Name,OU=Name,DC=DOMAIN,DC=com"-Filter*|foreach-object {

write-host"User:"$_.Name-foregroundgreen

    Get-ADPrincipalGroupMembership$_.SamAccountName|foreach-object {

        write-host"Member Of:"$_.name

    }

}

 

 

 

I am trying to get this out for a report to filter users by group.

Not sure where the output is required as I have tried several things but no luck.

Thanks,
Chris


Viewing all articles
Browse latest Browse all 6937

Trending Articles