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?
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.
Let's assume that you want to find sessions with an IdleTime value of greater than one day:
Connect-NcController <controller hostname or IP> Get-NcCifsSession | ? {$_.IdleTime -Match '([1-9]+)d[\w\s]*'} | Select-Object WindowsUser,Address,IdleTime
It'll return output that looks like this:
WindowsUser Address IdleTime----------- ------- --------Domain\user1 10.0.0.42 28d 1h 50m 47sDomain\user2 10.0.0.218 26d 20h 34m 51sDomain\user3 10.0.0.219 1d 9h 15m 6s
Here's an explanation of what the RegEx pattern does, for reference:
Donny
From storage end, you can run below command to list all the cifs sessions:
::> cifs session show
You can use question mark followed by this command which will list out many filters which can be used.
Use "-instance" followed by complete command to get more details about cifs sessions.
https://docs.netapp.com/ontap-9/index.jsp?topic=%2Fcom.netapp.doc.dot-cm-cmpr-930%2Fvserver__cifs__session__show.html
From windows client, you can use below command to list out cifs sessions:
>net use
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.
Let me know if this answers your query.
Hi @ManpreetS
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.
Hi @donny_lang
When I tried to run the script provided by you, I got the below error.