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.
For filtering by a specific SVM, you could use Read-Host to accept input from the person running the script, store it as a variable, and then use the variable in the -Vserver parameter of the Get-NcCifsSessionFile cmdlet.
For user/path, there isn't a cmdlet parameter that will accept those values, but you could collect the data using Get-NcCifsSession like you have in your code now, and then filter by user/path by piping Get-NcCifsSession to Where-Object to only show relevant data.