<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/126031#M5158</link>
    <description>&lt;P&gt;What version of Ontap are you using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My session ID is&amp;nbsp;4727372233855467525&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using ontap 9.0P1 and i'm not seeing an issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your session ID is one character bigger though&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS C:\powershell&amp;gt; $d = "15799753392746137485"&lt;BR /&gt;PS C:\powershell&amp;gt; $d.length&lt;BR /&gt;20&lt;BR /&gt;PS C:\powershell&amp;gt; $v = "4727372233855467525"&lt;BR /&gt;PS C:\powershell&amp;gt; $v.length&lt;BR /&gt;19&lt;/P&gt;</description>
    <pubDate>Wed, 07 Dec 2016 11:57:26 GMT</pubDate>
    <dc:creator>JGPSHNTAP</dc:creator>
    <dc:date>2016-12-07T11:57:26Z</dc:date>
    <item>
      <title>Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/126019#M5157</link>
      <description>&lt;P&gt;We're trying to use the Powershell&amp;nbsp;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you try to pass it into the Close-NcCifsSession (yes I know to really close it you would want&amp;nbsp;to pass more, but this is just to illustrate the problem) you get an error like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS C:\Users\cprivite&amp;gt; Close-NcCifsSession -SessionId $test[1].SessionId&lt;BR /&gt;&lt;STRONG&gt;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."&lt;/STRONG&gt;&lt;BR /&gt;At line:1 char:32&lt;BR /&gt;+ Close-NcCifsSession -SessionId $test[1].SessionId&lt;BR /&gt;+ ~~~~~~~~~~~~~~~~~~&lt;BR /&gt;+ CategoryInfo : InvalidArgument: (:) [Close-NcCifsSession], ParameterBindingException&lt;BR /&gt;+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,DataONTAP.C.PowerShell.SDK.Cmdlets.Cifs.CloseNcCifsSession&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can we get the Toolkit to be updated to use unsigned ints for values like this? Either ulong or System.uInt64 should both work.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 19:55:31 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/126019#M5157</guid>
      <dc:creator>cprivitere</dc:creator>
      <dc:date>2016-12-06T19:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/126031#M5158</link>
      <description>&lt;P&gt;What version of Ontap are you using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My session ID is&amp;nbsp;4727372233855467525&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using ontap 9.0P1 and i'm not seeing an issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your session ID is one character bigger though&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PS C:\powershell&amp;gt; $d = "15799753392746137485"&lt;BR /&gt;PS C:\powershell&amp;gt; $d.length&lt;BR /&gt;20&lt;BR /&gt;PS C:\powershell&amp;gt; $v = "4727372233855467525"&lt;BR /&gt;PS C:\powershell&amp;gt; $v.length&lt;BR /&gt;19&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 11:57:26 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/126031#M5158</guid>
      <dc:creator>JGPSHNTAP</dc:creator>
      <dc:date>2016-12-07T11:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/126747#M5181</link>
      <description>&lt;P&gt;We're using 9.0P1 as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just pulled a fresh session id off the filer, and it's "15441154272399424878" which is still 20 characters long.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jan 2017 22:43:11 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/126747#M5181</guid>
      <dc:creator>cprivitere</dc:creator>
      <dc:date>2017-01-05T22:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: Close-NcCifsSession won't work due to session id being greater than signed 64bit int can hold</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/140155#M5738</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I struggled with this one for a while, but did eventually find a solution (or more correctly, a work-around).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the Invoke-NcSsh&amp;nbsp; function (requires PS Toolkit 4.5.1,&amp;nbsp; and you'll need to enable SSH access as well as ONTAPI for the account you use)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's a function I use to close CIFS sessions from a specified client IP:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Function Close-NtapSessions () {&lt;BR /&gt;&amp;nbsp; Param(&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [Parameter(Mandatory=$True,Position=0,HelpMessage="IP address of client")]&lt;BR /&gt;&amp;nbsp; &amp;nbsp; [string]$ClientIP = ''&lt;BR /&gt;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;Write-Output "`Retrieving CIFS sessions for $ClientIP"&lt;BR /&gt; $ClientIP = $ClientIP -replace '\s',''&lt;BR /&gt; $sessions = Get-NcCifsSession -Query @{Address=$ClientIP} | select "Address","ConnectionId","SessionId", "Node", "Vserver", "ConnectedTime"&lt;BR /&gt; $sessions | Format-List | Write-Output&lt;BR /&gt; if ($sessions) {&lt;BR /&gt;&amp;nbsp; $cluster = (Get-NcCluster).ClusterName&lt;BR /&gt;&amp;nbsp; foreach ($session in $sessions ) {&lt;BR /&gt;&amp;nbsp; &amp;nbsp; $Vserver = $session.Vserver&lt;BR /&gt;&amp;nbsp; &amp;nbsp; $SessionId = $session.SessionId&lt;BR /&gt;&amp;nbsp; &amp;nbsp; $ConnectionId = $session.ConnectionId&lt;BR /&gt;&amp;nbsp; &amp;nbsp; $node = $session.Node&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Write-Output "Running: cifs session close -node $node -session-id $SessionId -connection-id $ConnectionId -vserver $Vserver"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Invoke-NcSsh -Command "cifs session close -node $node -session-id $SessionId -connection-id $ConnectionId -vserver $Vserver"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; }&lt;BR /&gt; }&lt;BR /&gt; else {&lt;BR /&gt;&amp;nbsp; Write-Output " No connected sessions found."&lt;BR /&gt; }&lt;BR /&gt; Write-Output "`nAfter close - Retrieving CIFS sessions for $($ClientIP):"&lt;BR /&gt; $sessions = Get-NcCifsSession -Query @{Address=$ClientIP} | select "Address","ConnectionId","SessionId", "Node", "Vserver", "ConnectedTime"&lt;BR /&gt; if ($sessions) { $sessions | Format-List }&lt;BR /&gt; else {Write-Output " No connected sessions found.`n" }&lt;/P&gt;
&lt;P&gt;return ($_)&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;- MIke C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2018 20:28:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Close-NcCifsSession-won-t-work-due-to-session-id-being-greater-than-signed-64bit/m-p/140155#M5738</guid>
      <dc:creator>MikeC_12</dc:creator>
      <dc:date>2018-05-10T20:28:24Z</dc:date>
    </item>
  </channel>
</rss>

