I am trying to export all folders including child folders within a file share on a remote server alongside the owner info as shown (Note I do not need info re the files within the folders)
get-childitem \\fileshare\folder -recurse | get-acl | select-object path,owner,accesstostring,group | export-csv “C:\security.csv”
Whilst this works to a degree it includes all files and not specifically folders within the directory. Note I have also created a temp PS Drive to minimize folder naming length;
new-psdrive -Name X -PSProvider FileSystem -Root \\server\share\folder1\folder2\folder3
Can someone please assist?
Best Answer
Then check for folders with either the
-Directory
parameter of Get-ChildItem present in recent Powershell versions or use this:( I prefer a more readable variant of this technical still one liner )