Quantcast
Channel: ONTAP Discussions topics
Viewing all articles
Browse latest Browse all 4954

Needs Help for CIFS open files in PowerShell

$
0
0

Hello Everyone, 

I am trying to create a script file to get a list of CIFS open file through the PowerShell tool and the main reason of creating this script is our helpdesk team wants to see who left a file open and ask him to close it. We don't wanna use the MMC feature since it provides some unwanted access for helpdesk team. 

I am using the following context and it's working but it generates an output of all SVMs and I wanna be more specific . So, I like to provide an ability for helpdesk team to input a desire SVM name or  Windows User or path. this file will be exported to a csv file to facilitate searching purpose.

Connect-NcController "Controller Name"
Add-NcCredential
Get-NcCifsSessionFile | %{
$session = Get-NcCifsSession -SessionId $_.SessionId

$data = "" | Select "WindowsUser", "SVM", "Path"
$data.WindowsUser = $session.WindowsUser
$data.SVM = $_.Vserver
#$data.SVM =
$data.Path = "\\$($session.LifAddress)\$($_.Share)\$($_.Path)"

$data
}  | Export-Csv -Path "c:\cifs.csv"  -UseCulture -NoTypeInformation

 


Viewing all articles
Browse latest Browse all 4954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>