0

I'm migrating a NetApp NTFS based filesystem. It is mounted on both Windows and Linux boxes. My validation script in Powershell is walking the file system and doing various checks that the source and target are the same. It checks timestamps and checksums for example.

It also compares ACLs using the sddl property of the get-acl. However, some of the files are actually Linux symbolic links. In this case, everything works but the get-acl call throws an error

Get-Acl : Attempted to perform an unauthorized operation.

In this case, the security is really on the link target, so I don't need to check this. However, I can't figure out how to skip checking these files since I cannot figure out how to detect that they are Linux symbolic links.

Is there a way to detect that a file is a Linux symbolic link so that I can skip the get-acl check?

0

1 Answer 1

1

I would just use try and catch. Attempt to do your work on a file, if it fails, gracefully skip to the next one.

2
  • I thought about this approach, but I'm worried that if I get the error for a reason other than it being a symbolic link that I would actually want to properly report that error. I'm not sure of all the reasons why get-acl might fail. Perhaps as long as it fails on both the source and the target then this is a properly validation that migration is correct.
    – RobertB
    May 12, 2017 at 1:11
  • You can use try with a specific error. Presumably, this would be the only situation that would generate this specific error.
    – Basil
    May 12, 2017 at 1:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .