<?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: Find CIFS session of named open file in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/120152#M4856</link>
    <description>&lt;P&gt;I found this thread and found it helpful for 7-mode and wanted to update for cDOT:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use a combination of the following 2 commands to get the same information in cDOT at the CLI:&lt;/P&gt;&lt;P&gt;cifs session show -instance &amp;nbsp;(user info)&lt;/P&gt;&lt;P&gt;cifs session file show -instance &amp;nbsp; (open file info)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use the connection ID field to link between the two outputs to establish the files a particular user has open.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To close a session or file you could then use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cifs session close&lt;/P&gt;&lt;P&gt;cifs session file close&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At least at 8.3+ you can also use the MMC to gather this information and close files/sessions if you have the appropriate permissions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am unsure about other methods like Powershell.&lt;/P&gt;</description>
    <pubDate>Sun, 12 Jun 2016 05:50:34 GMT</pubDate>
    <dc:creator>Mike_Pedigo</dc:creator>
    <dc:date>2016-06-12T05:50:34Z</dc:date>
    <item>
      <title>Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34546#M1577</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please tell me, how to find the CIFS session of an open file and how to terminate it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Nov 2010 12:33:26 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34546#M1577</guid>
      <dc:creator>wippel</dc:creator>
      <dc:date>2010-11-05T12:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34551#M1578</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see any Data ONTAP APIs that do what you seek.&amp;nbsp; Get-NaCifsSession can tell you about users and volumes being accessed, but not files.&amp;nbsp; And I don't see any API to terminate an individual session.&amp;nbsp; You might experiment with manipulating the CIFS share ACLs, but otherwise you would have to call Disable-NaCifs, which is admittedly rather drastic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Nov 2010 14:16:35 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34551#M1578</guid>
      <dc:creator>cknight</dc:creator>
      <dc:date>2010-11-05T14:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34555#M1579</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do it from the Windows' "Computer Management" interface. Open it (compmgmt.msc) and connect to your filer/vfiler (by right-clicking the "Computer Management (Local)" in the first line of the left half of the screen -&amp;gt; connect to another computer). Down there you can find "Shared Folders" -&amp;gt; "Open Files". You can see there all the open files and sessions to your filer/vfiler and by right-clicking the specific open file you want to terminate, a terminate option will appear (don't remember the exact option, but it's there).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it's helpful and what you asked for.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Nov 2010 23:12:05 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34555#M1579</guid>
      <dc:creator>mh_sh_team</dc:creator>
      <dc:date>2010-11-06T23:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34558#M1580</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure enough, that works.&amp;nbsp; Also means that it should be possible via WMI, which by extension means PowerShell.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;J&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Nov 2010 04:38:56 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34558#M1580</guid>
      <dc:creator>fjohn</dc:creator>
      <dc:date>2010-11-08T04:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34563#M1581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ONTAP command&lt;/P&gt;&lt;P&gt;&amp;gt;cifs sessions *&lt;/P&gt;&lt;P&gt;shows all open files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ONTAP command&lt;/P&gt;&lt;P&gt;&amp;gt;cifs terminate [workstation]&lt;/P&gt;&lt;P&gt;allows to terminate a single session.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Nov 2010 08:09:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34563#M1581</guid>
      <dc:creator>wippel</dc:creator>
      <dc:date>2010-11-08T08:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34568#M1582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had no luck finding a way to do close a file in .NET, WMI, ADSI or COM. &lt;SPAN __jive_emoticon_name="sad" __jive_macro_name="emoticon" class="jive_macro jive_emote" src="https://community.netapp.com/4.0.8/images/emoticons/sad.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you know a way?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 26 Nov 2010 08:25:06 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/34568#M1582</guid>
      <dc:creator>wippel</dc:creator>
      <dc:date>2010-11-26T08:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/120152#M4856</link>
      <description>&lt;P&gt;I found this thread and found it helpful for 7-mode and wanted to update for cDOT:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can use a combination of the following 2 commands to get the same information in cDOT at the CLI:&lt;/P&gt;&lt;P&gt;cifs session show -instance &amp;nbsp;(user info)&lt;/P&gt;&lt;P&gt;cifs session file show -instance &amp;nbsp; (open file info)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use the connection ID field to link between the two outputs to establish the files a particular user has open.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To close a session or file you could then use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cifs session close&lt;/P&gt;&lt;P&gt;cifs session file close&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At least at 8.3+ you can also use the MMC to gather this information and close files/sessions if you have the appropriate permissions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am unsure about other methods like Powershell.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jun 2016 05:50:34 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/120152#M4856</guid>
      <dc:creator>Mike_Pedigo</dc:creator>
      <dc:date>2016-06-12T05:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Find CIFS session of named open file</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/121479#M4958</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know it is a little late to send you this message but maybe someone else needs it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a script that copy folders from a source UNC path to a destination and closes open sessions of exe files. This scripts if for 7-Mode filers but you can change it for your needs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;#&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.SYNOPSIS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This is a function to copy system files from a source folder to a target folder.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .DESCRIPTION&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It is used to copy files from a source folder to a target folder. If any .EXE file is in use it closes the session before copy operation.&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .PARAMETER Source&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Is an UNC source path for system's files (\\filer\share\folder\sub-subfolder\...).&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .PARAMETER Target&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Is an UNC target path for system's files (\\filer\share\folder\sub-subfolder\...).&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .EXAMPLE&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Copy-SystemFiles.ps1 -Source \\filer1\share1\folder\sub-folder\third-level-folder \\filer2\share2\folder&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Will copy every file in the souce folder to target folder closing every executable .EXE files before copy operation.&lt;BR /&gt;&lt;BR /&gt;#&amp;gt;&lt;BR /&gt;&lt;BR /&gt;Param(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Parameter(Mandatory=$true)]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [string]$Source,&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Parameter(Mandatory=$true)]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [string]$Target&lt;BR /&gt;)&lt;BR /&gt;&lt;BR /&gt;function Get-InternalPath {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Param(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Parameter(Mandatory = $true)]&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [string]$Path&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $PathArray = $Path.Split('\')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $Filer = $PathArray[2]&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Connect-NaController -Name $Filer |Out-Null&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $MountPoint = (Get-NaCifsShare -Share $PathArray[3]).MountPoint&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $FullPath = "C:$MountPoint"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for ($i = 4; $i -lt $PathArray.Length; $i++) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $FullPath += "\$($PathArray[$i])"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return $($FullPath.Replace('/','\'))&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;try{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get-ChildItem -Path $Source|ForEach-Object {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $FileName=$_.FullName&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if($FileName.EndsWith(".exe")) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $TargetFiler = $Target.Split("\")[2]&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cmd /c "openfiles /Disconnect /S $TargetFiler /A * /OP $(Get-InternalPath -Path $Target)" |Out-Null&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Copy-Item -Recurse -Force -Path $FileName -Destination $Target -Verbose&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;catch{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ErrorMessage = $_.Exception.Message&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $FailedItem = $_.Exception.ItemName&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output $FailedItem&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Write-Output $ErrorMessage&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 18:05:48 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Find-CIFS-session-of-named-open-file/m-p/121479#M4958</guid>
      <dc:creator>FelipeMafra</dc:creator>
      <dc:date>2016-07-19T18:05:48Z</dc:date>
    </item>
  </channel>
</rss>

