<?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: How to find stale cifs sessions in Netapp in ONTAP Discussions</title>
    <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150136#M33396</link>
    <description>&lt;P&gt;Looks like you weren't able to successfully connect to your controller. Can you run "system services web show" from the ONTAP CLI and paste the output here?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 13:31:42 GMT</pubDate>
    <dc:creator>donny_lang</dc:creator>
    <dc:date>2019-08-08T13:31:42Z</dc:date>
    <item>
      <title>How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149768#M33325</link>
      <description>&lt;P&gt;There is a requirement in my organization. I have to find the stale CIFS sessions and list them across the globe. Is there any command or process to find them?&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 12:22:47 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149768#M33325</guid>
      <dc:creator>PnaveenKumar</dc:creator>
      <dc:date>2025-06-04T12:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149935#M33358</link>
      <description>&lt;P&gt;From storage end, you can run below command to list all the cifs sessions:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;::&amp;gt; cifs session show&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;You can use question mark followed by this command which will list out many filters which can be used.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use "-instance" followed by complete command to get more details about cifs sessions.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.netapp.com/ontap-9/index.jsp?topic=%2Fcom.netapp.doc.dot-cm-cmpr-930%2Fvserver__cifs__session__show.html" target="_blank"&gt;https://docs.netapp.com/ontap-9/index.jsp?topic=%2Fcom.netapp.doc.dot-cm-cmpr-930%2Fvserver__cifs__session__show.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From windows client, you can use below command to list out cifs sessions:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;gt;net use&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Stale cifs sessions can be found out by listing cifs sessions on storage end and comparing them with sessions running on client. If sessions are available on client but not listing out in storage then those sessions are stale and will not be accessible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this answers your query.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 01:23:10 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149935#M33358</guid>
      <dc:creator>ManpreetS</dc:creator>
      <dc:date>2019-07-31T01:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149947#M33362</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/75397"&gt;@ManpreetS&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know how to check CIFS sessions on NetApp, but here is the actual requirement, we are trying to write a script to find the stale sessions in all the NetApp Arrays. If you know how to proceed further. Please guide me through the process.&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 10:49:00 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149947#M33362</guid>
      <dc:creator>PnaveenKumar</dc:creator>
      <dc:date>2019-07-31T10:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149954#M33364</link>
      <description>&lt;P&gt;You can do it with a couple lines of PowerShell (RegEx with the assist) which could easily be put into a script that loops through a list of all of your controllers.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's assume that you want to find sessions with an IdleTime value of greater than one day:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Connect-NcController &amp;lt;controller hostname or IP&amp;gt; &lt;BR /&gt;Get-NcCifsSession | ? {$_.IdleTime -Match '([1-9]+)d[\w\s]*'} | Select-Object WindowsUser,Address,IdleTime&lt;/PRE&gt;
&lt;P&gt;It'll return output that looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;WindowsUser           Address        IdleTime
-----------           -------        --------
Domain\user1         10.0.0.42       28d 1h 50m 47s
Domain\user2         10.0.0.218      26d 20h 34m 51s
Domain\user3         10.0.0.219      1d 9h 15m 6s
&lt;/PRE&gt;
&lt;P&gt;Here's an explanation of what the RegEx pattern does, for reference:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="regex.png" style="width: 632px;"&gt;&lt;img src="https://community.netapp.com/t5/image/serverpage/image-id/9198iB93183AC863AFCF1/image-size/large?v=v2&amp;amp;px=999" role="button" title="regex.png" alt="regex.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Donny&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 15:09:57 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/149954#M33364</guid>
      <dc:creator>donny_lang</dc:creator>
      <dc:date>2019-07-31T15:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150135#M33395</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/77625"&gt;@donny_lang&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I tried to run the script provided by you, I got the below error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cifs_script_issue.JPG" style="width: 814px;"&gt;&lt;img src="https://community.netapp.com/t5/image/serverpage/image-id/9217i9602DD3CD8B9C4C9/image-size/large?v=v2&amp;amp;px=999" role="button" title="cifs_script_issue.JPG" alt="cifs_script_issue.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 13:20:44 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150135#M33395</guid>
      <dc:creator>PnaveenKumar</dc:creator>
      <dc:date>2019-08-08T13:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150136#M33396</link>
      <description>&lt;P&gt;Looks like you weren't able to successfully connect to your controller. Can you run "system services web show" from the ONTAP CLI and paste the output here?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 13:31:42 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150136#M33396</guid>
      <dc:creator>donny_lang</dc:creator>
      <dc:date>2019-08-08T13:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150138#M33397</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/77625"&gt;@donny_lang&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please find the output here. Looks like HTTP and HTTPS are turned on.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="smaolab.JPG" style="width: 291px;"&gt;&lt;img src="https://community.netapp.com/t5/image/serverpage/image-id/9218i68901717113F0EB3/image-size/large?v=v2&amp;amp;px=999" role="button" title="smaolab.JPG" alt="smaolab.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 13:36:22 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150138#M33397</guid>
      <dc:creator>PnaveenKumar</dc:creator>
      <dc:date>2019-08-08T13:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150140#M33398</link>
      <description>&lt;P&gt;Do you possibly have a firewall policy blocking the traffic? I'm assuming that you're connecting to your cluster management LIF in your screenshot - can you run "system services firewall policy show" and "net int show -role cluster-mgmt -fields firewall-policy" to make sure that your connection is allowed?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you try manually specifying an HTTPS connection by adding the "-HTTPS" parameter in your "Connect-NcController" command?&lt;/P&gt;
&lt;P&gt;What version of ONTAP are you running?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 13:55:35 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150140#M33398</guid>
      <dc:creator>donny_lang</dc:creator>
      <dc:date>2019-08-08T13:55:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150145#M33399</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/77625"&gt;@donny_lang&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will test this script in LAB and see if it works as there will be no restrictions in LAB.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks, Donny. I will get back to you soon.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 16:29:39 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150145#M33399</guid>
      <dc:creator>PnaveenKumar</dc:creator>
      <dc:date>2019-08-08T16:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150147#M33400</link>
      <description>&lt;P&gt;You can also get it via CLI.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;vserver cifs session show -node xxx -fields idle-time&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can then grep it for what you are looking for.&amp;nbsp; Not as elegant as PS, but it gives you output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:40:37 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150147#M33400</guid>
      <dc:creator>Tas</dc:creator>
      <dc:date>2019-08-08T17:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150148#M33401</link>
      <description>&lt;P&gt;Sorry;&amp;nbsp; a better method to show you sessions idle for &amp;gt; than number of days would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;vserver cifs session show -idle-time \&amp;gt;=1d&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This would list all sessions idle over 1 day, the user, and the machine IP utilizing it.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:54:09 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150148#M33401</guid>
      <dc:creator>Tas</dc:creator>
      <dc:date>2019-08-08T17:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150180#M33410</link>
      <description>&lt;P&gt;hi &lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/49710"&gt;@Tas&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It was not successful. Please find the output below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cluster1::&amp;gt; vserver cifs session show -idle-time \&amp;gt;=1m&lt;/P&gt;
&lt;P&gt;Error: "\&amp;gt;=1m" is an invalid value for field "-idle-time &amp;lt;elapsed&amp;gt;"&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 12:45:05 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150180#M33410</guid>
      <dc:creator>PnaveenKumar</dc:creator>
      <dc:date>2019-08-09T12:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150186#M33411</link>
      <description>&lt;P&gt;Yes.&amp;nbsp; Sorry, but don't use the '\' if you are running directly in a session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You only need to use it if you are scripting it, so you can escape the &amp;gt; (redirect symbol).&lt;/P&gt;
&lt;P&gt;TasP&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 13:22:44 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150186#M33411</guid>
      <dc:creator>Tas</dc:creator>
      <dc:date>2019-08-09T13:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150190#M33413</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/49710"&gt;@Tas&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried with both, but no use.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Script:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;import paramiko&lt;/P&gt;
&lt;P&gt;#Below line will initiate an object for ssh connectivity.&lt;/P&gt;
&lt;P&gt;p = paramiko.SSHClient()&lt;/P&gt;
&lt;P&gt;#Below line will open a the credential file in read mode where we have credential fo the devices.&lt;/P&gt;
&lt;P&gt;cred = open("cred.csv","r")&lt;/P&gt;
&lt;P&gt;#Now below is the for loop which will iterate over each line of the file and get the credential, login to the device and execute a command. Then the output of the command for each device will be saved in a text file.&lt;/P&gt;
&lt;P&gt;for i in cred.readlines():&lt;BR /&gt;line=i.strip()&lt;BR /&gt;ls =line.split(",")&lt;BR /&gt;print(ls)&lt;BR /&gt;p.set_missing_host_key_policy(paramiko.AutoAddPolicy())&lt;BR /&gt;p.connect("%s"%ls[0],port =22, username = "%s"%ls[1], password="%s"%ls[2])&lt;BR /&gt;stdin, stdout, stderr = p.exec_command("vserver cifs session show -idle-time \&amp;gt;=1d")&lt;BR /&gt;opt = stdout.readlines()&lt;BR /&gt;opt ="".join(opt)&lt;BR /&gt;print(opt)&lt;BR /&gt;temp=open("%s.txt"%ls[0],"w")&lt;BR /&gt;temp.write(opt)&lt;BR /&gt;temp.close()&lt;BR /&gt;cred.close()&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have tried above script with \ and with out \, but i got error like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cifs.JPG" style="width: 562px;"&gt;&lt;img src="https://community.netapp.com/t5/image/serverpage/image-id/9230iE2764223323B6F11/image-size/large?v=v2&amp;amp;px=999" role="button" title="cifs.JPG" alt="cifs.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 14:32:42 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150190#M33413</guid>
      <dc:creator>PnaveenKumar</dc:creator>
      <dc:date>2019-08-09T14:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to find stale cifs sessions in Netapp</title>
      <link>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150195#M33414</link>
      <description>&lt;P&gt;I would suggest you try it directly in an ssh session;&amp;nbsp; then you will know whether it will work or not.&amp;nbsp; I would also make you idle time &amp;gt;=1d to start testing.&lt;/P&gt;
&lt;P&gt;BTW, you are running ONTAP (Clustered Ontap and not 7-mode?)&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2019 19:37:01 GMT</pubDate>
      <guid>https://community.netapp.com/t5/ONTAP-Discussions/How-to-find-stale-cifs-sessions-in-Netapp/m-p/150195#M33414</guid>
      <dc:creator>Tas</dc:creator>
      <dc:date>2019-08-09T19:37:01Z</dc:date>
    </item>
  </channel>
</rss>

