Microsoft Virtualization Discussions

Possible bug with close-nccifssession


I'm not quite sure what is going on here, but this should be simple pipeline to close-nccifssession


First we see this


PS C:\powershell> get-nccifssession | ? {$_.windowsuser -match "userid"} | close-nccifssession -confirm:$false
close-nccifssession : Parameter 'SessionId' is mandatory for Data ONTAP 9.0 and up.
At line:1 char:61
+ ... windowsuser -match "userid"} | close-nccifssession -confirm:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (filer:NcController) [Close-NcCifsSession], ArgumentException
+ FullyQualifiedErrorId : SessionIdRequired,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.CloseNcCifsSession


Then we try this


PS C:\powershell> close-nccifssession -SessionId 13404964290887995043
Close-NcCifsSession : Cannot bind parameter 'SessionId'. Cannot convert value "13404964290887995043" to type "System.Int64". Error: "Value was
either too large or too small for an Int64."
At line:1 char:32
+ close-nccifssession -SessionId 13404964290887995043


This has to be some sort of bug  


Too big to convert I'm afraid: PS C:\WINDOWS\system32> [int64]::MaxValue 9223372036854775807 13404964290887995043 is longer by 1 char and exceeds the range. POwershell is working fine but it seems like the cmdlet has not accounted for the sessionID being longer. One way around it would likely be to use powershell with one of the invoke cmdlets to run the command at the cluster head.


I forgot to mention that I already knew it was 1 digit bigger than max value.  I checked that as well. That was my first run at this.


Invoke-ncssh works, but is not nearly as easy as passing the pipeline.


I think the team needs to fix this.. maybe pass as string..


Perhaps the cmdlet for sessionid needs to be changed from int64 to decimal


PS C:\powershell> [decimal]13404964290887995043
PS C:\powershell> [decimal]13404964290887995043 | gm

TypeName: System.Decimal




There is already a bug (1142906) open on this : )



If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.


Andrew.. How funny.. I should have searched!


Duh... Thanks for helping me search.. and was nice to meet you