简体   繁体   中英

PowerShell Export-CSV format

I may be asking for too much. I've been tasked with writing a PowerShell script that will extract file share info. Here's an example scenario:

Start with a list of three servers. Each server has five fixed disks. Each fixed disk has ten shares. Each share ACL lists fifteen groups with various read/write permissions.

Doing the math, that's 2,250 discrete pieces of information.

My script is finished, but all it does is spit out the information into a text file, which is cumbersome to work with. Management much prefers spreadsheets that they can sort-n-filter.

But I can't figure out how to take that river of info and format it into one csv file. What should the column headers be? Each cell would be something like: "Server 1, Disk C, Share ABC, Group Marketing, Permission Read", "Server 2, Disk D, Share XYZ, Group Finance, Permission Full Control", and so on.

How to output this depends on what objects you're script are creating and due to the lack of a sample there's not much we can help you with other than saying that this is possible to do.

The only question I see here is

What should the column headers be?

Here's my suggestion:

Server,Disk,Share,Identity,Permission

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM