Subscribe

Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold

We're trying to use the Powershell Toolkit to manage file locks. Part of this process includes getting and passing through CIFS Session IDs to tell it exactly what locks to close from which user.

 

What we've noticed however, is that the variable type being used to hold the Session ID is not large enough to hold the actual value that OnTap uses. 

 

For example, a user right now has a file open. His Session ID is "15799753392746039225". That is larger than a signed 64 bit int can hold.

 

When you try to pass it into the Close-NcCifsSession (yes I know to really close it you would want to pass more, but this is just to illustrate the problem) you get an error like this:

 

PS C:\Users\cprivite> Close-NcCifsSession -SessionId $test[1].SessionId
Close-NcCifsSession : Cannot bind parameter 'SessionId'. Cannot convert value "15799753392746137485" to type "System.Int64". Error: "Value was either too large or too small for an Int64."
At line:1 char:32
+ Close-NcCifsSession -SessionId $test[1].SessionId
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Smiley Happy [Close-NcCifsSession], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.CloseNcCifsSession

 

 

 

Can we get the Toolkit to be updated to use unsigned ints for values like this? Either ulong or System.uInt64 should both work.

Re: Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold

What version of Ontap are you using.

 

My session ID is 4727372233855467525

 

I'm using ontap 9.0P1 and i'm not seeing an issue

 

Your session ID is one character bigger though

 

PS C:\powershell> $d = "15799753392746137485"
PS C:\powershell> $d.length
20
PS C:\powershell> $v = "4727372233855467525"
PS C:\powershell> $v.length
19

Re: Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold

We're using 9.0P1 as well.

 

I just pulled a fresh session id off the filer, and it's "15441154272399424878" which is still 20 characters long.