0

I am trying to capture the shares on a given file server. Then getting the ACL (access control list) from a share (doing this manually atm). Then from that share, getting the get-childitem. Can someone help me consolidate this to one line?

Eventually I will have to dump the output to a CSV.

Get all shares

Get-WmiObject -Class Win32_Share -Computer SERVER01 | FT path, name -AutoSize

Get ACL from a given share

(Get-ACL C:\FileShare\testFolder01).Access

Get-ChildItem from a given share

Get-ChildItem C:\FileShare\testFolder02 -Rec | Select-Object DirectoryName, Name, CreationTime, LastWriteTime, Extension | sort DirectoryName, Name
Community
  • 1
  • 1
user2945461
  • 23
  • 1
  • 3

1 Answers1

0

A oneliner for something like that would be pretty crazy do-able but crazy. When ever I run into this I use a loop of some kind normally a foreach and then create a PS custom object. Below is a great blog post on how to create custom PS objects. I'd recommend looking at doing that.

http://www.powershellmagazine.com/2013/02/04/creating-powershell-custom-objects/

joshduffney
  • 389
  • 1
  • 4
  • 16