BManTAU
BManTAU

Reputation: 11

Using Powershell to export NTFS permissions

I am making use of this script to export NTFS permissions from a large folder structure on a file server. I get the information I want to see using out-gridview, but I need it in CSV format.

Here is what currently works:

Get-ChildItem -recurse -force C:\Test -Directory | get-acl | out-gridview

So I tried the following to get it into CSV format:

Get-ChildItem -recurse -force C:\Test -Directory | get-acl |export-csv C:\temp\permissions.csv

However, the output now includes the following in the CSV output:

Microsoft.PowerShell.Core\FileSystem::C:\Test\Subfolder1

How do I exclude the above from the output?

Upvotes: 1

Views: 12262

Answers (1)

Micky Balladelli
Micky Balladelli

Reputation: 10001

The path must be converted, there is an example of this using ACLs here

Get-ChildItem -recurse -force c:\test -Directory | get-acl | %{$_| Add-Member -NotePropertyName Folder -NotePropertyValue (Convert-Path $_.path) -PassThru }|select -ExpandProperty access -property Folder, owner|export-csv C:\temp\permissions.csv -NoTypeInformation

Upvotes: 1

Related Questions