It's a pain, since OneDrive uses its own type of NTFS ReparsePoint
, so even the new versions of powershell don't have the tools to view the target, or really differentiate one from another. I did find they have a specific reparse point tag by using Get-ReparsePoint
from the powershell community extensions module (pscx). In this case, Documents\
is a link to a sharepoint document library, and TestFolder\
is a folder created in windows explorer:
Get-ChildItem -Attributes ReparsePoint | Get-ReparsePoint
Path ReparsePointTag
---- ---------------
C:\users\user\OneDrive - domain.com\Documents 2415943706
C:\users\user\OneDrive - domain.com\Microsoft Teams Chat Files 2415943706
C:\users\user\OneDrive - domain.com\Notebooks 2415943706
C:\users\user\OneDrive - domain.com\TestFolder 2415976474
C:\users\user\OneDrive - domain.com\TestFolder\test.txt 2415943706
C:\users\user\OneDrive - domain.com\Test.txt 2415943706
I converted the tag values to hex, and used this Microsoft Docs list of reparse point tags to see... not much, just that these are all OneDrive-related:
2415935514 = 0x9000401A = IO_REPARSE_TAG_CLOUD_4
2415943706 = 0x9000601A = IO_REPARSE_TAG_CLOUD_6
2415976474 = 0x9000E01A = IO_REPARSE_TAG_CLOUD_E
From the small amount of testing I did, I think you could use this to list directories with the ReparsePointTag
of 2415943706
and feed them to your robocopy script to exclude them.
It might be a better idea to revisit using robocopy to back up a user's local onedrive files instead of something native to onedrive.
Attributes
for the link?525329
? If you view the contents of the directory in Cmd / PowerShell (using -Force), does it contain adesktop.ini
file and atarget.lnk
file?