Making a GroupName the .csv Filename?

Hello, this may be a simple question but it is one that I am having trouble with since I am fairly new to PowerShell.

I have a program which grabs specific columns from groups and puts them into a .csv file. To give an example but not specific property types:

Get-Childitem | Format-Table -Property groupname, columna | Export-csv groupname.csv 

The groupname.csv is where I am trying to run a separate alias run inside this pipeline. I want this alias to grab the groupname and make it be the filename. However, I also want it to grab only the names associated with its group.

I.E Output

GroupName———–Column A

Group 1——————-Name

Group 1——————-Name 2

Group 2——————-Name 3

Group 2——————-Name 4

Get-Childitem | Format-Table -Property groupname, columna 

Intended Alias Example:

  1. Grabs the groupname and all names from Column A that are in Group 1 to export to the .csv
  2. the .csv file is named after the Group 1 name (it grabs it)
  3. Repeats/Loops for Group 2 and on.

Can Anyone help?

submitted by /u/ImprovingPiano
[link] [comments]

Leave a Reply