Get-HardlinkInfo Script fails with OverflowException

by mowfax at 2013-03-04 16:28:12

Hello,

I need a function to find out if an NTFS file has hardlink siblings and if yes, which ones.
There’s already a script for that, I found it here: http://powershellcommunity.poshcode.org/3293

Problem is that I get this Error when using it:

Ausnahme beim Aufrufen von "GetFileSiblingHardLinks" mit 1 Argument(en): "Die arithmetische Operation hat einen Ãœberlauf verursacht."
In D:\testfiles\pshell_script\Get-HardlinkInfo.ps1:138 Zeichen:3
+ $links = [HardLinkEnumerator.Kernel32Api]::GetFileSiblingHardLinks($filepath)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:slight_smile: , MethodInvocationException
+ FullyQualifiedErrorId : OverflowException

(sorry for the german description, I don’t know how to get pshell to give me english errors)

If I use the switch "-count" I get a number and no error. However if I only give a -filepath, it gives me the error. Doesn’t matter if I also add the parameter "-all" on top of it.
My guess is that the error lies within the typedef stuff.

If there is a completely other solution to get to my goal in finding hardlinks with pshell that’s fine, too.
Thanks in advance…
by DonJ at 2013-03-06 03:53:38
Can you translate the error? I’ve no idea what it means.
by TomKemp at 2013-04-25 03:54:53
Google Translate says this means ‘Arithmetic Operation resulted in an overflow’.

Hope that helps