Hello,
I currently use the snippet below to check for folder permissions, it outputs a CSV file which details Category, Reason and TargetName. When I open my error.csv file I see the 3 columns being populated, but how can I get a 4th column with the directory name as well? TargetName outputs the complete path to the folder, I want to also include the directory name in the CSV.
$Path = "C:\test" $errors=@() get-childitem -recurse $Path -ea silentlycontinue -ErrorVariable +errors | Out-Null $errors | select -expand categoryinfo | select category,reason,targetname | export-csv -NoTypeInformation -Delimiter “,” .\error.csv
Any help would be appreciated. At this point I dont think getting the directory name only is feasible with my method. I've tried many exampled but cant seem to get it. As easy as it may sound.
Thank you.