PS Shared Session Module

The PSSharedSession module allow you to manage session on File Serwer. It allow to list session to shared folders and open files on shared location. Additionally script allow to basic close session and opened files – this solution is not perfect but it should suffice.

Module can be installed manualy by downloading Zip file and extract in two places:

Importing the module

PS > Import-Module PSSharedSession

 

Prerequisites

Windows PowerShell 2.0

 

Available functions

 

Examples of using the module (Source code of module is in attachment):

 

PowerShell
Edit|Remove
PS C:\>"MyFS" | Get-SharedSession | Format-Table * -AutoSize 
Server IdleTime ConnectTime Computer       User          OpenFiles 
------ -------- ----------- --------       ----          --------- 
MyFS   00:32:29 7.03:23:49  10.10.10.1     MG                    1 
 
 
PS C:\>"MyFS" | Get-SharedSession | Where {$_.User -eq "MG"| Close-Session 
 
Server                                  Computer                              Status 
------                                  --------                              ------ 
MyFS                                    10.10.10.1                            Open files closed 
 
 
PS C:\>"MyFS" | Get-OpenFiles | Format-Table Server, ID, User, LockCount, Path -AutoSize 
Server ID     User       LockCount Path 
------ --     ----       --------- ---- 
MyFS   108618 MG                 0 G:\Test\Test.txt 
 
 
PS C:\>"MyFS" | Get-OpenFiles | Where {$_.User -eq "MG"| Close-OpenFiles 
 
ID                                      Server                                  Status 
--                                      ------                                  ------ 
312742                                  MyFS                                    File closed