Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

PowerShell Output - Need Help Exporting / Format to CSV File

$
0
0

Hi everyone

Im trying to make a script where i  can list all computers with a name like 'ATANS*" and their group membership.

Im pretty newbie at scripting so i guess my code is not the best. But it does the job, all i want is to get the result to a csv file

Hope someone can be of assistance

Get-ADcomputer -Filter "Name -like 'ATANS*'"  | ForEach {
    Write-Host "$_ is a member of the following groups:"
    Get-ADComputer $_ -Properties memberOf | Select -ExpandProperty memberOf
    Write-Host

}

I have tried but all the csv files is empty?


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>