Close SMB Sessions And Open Files On Nano Server 20106 File Server Using PowerShell

In my last article on the Nano Server 2016 File Server SMB File Share topic I’ll show you how I view and close open sessions \ Files of users connected to my SMB Share.

Articles previously published on this series:

If you haven’t setup your Nano Server use my article on how to Install And Run Nano Server Technical Preview 5.

Once your Nano Server Is Configured Connect to It using PowerShell Direct, Connect To A Nano Server Using PowerShell Direct or using PowerShell Remoting How To Connect To A Windows Nano Server Using PowerShell.

To view all open session on my Nano File Server I type:

Get-SmbSession |select sessionid, ClientUsername, NumOpens

To view open files I use:

Get-SmbOpenFile | select fileid, sessionid,path, clientusername

To close specific session I type:

Close-SmbSession -SessionId 549755813905 -Confirm:$false -Verbose -PassThru


To close open file I use:

Close-SmbOpenFile -SessionId 549755813909 -Confirm:$false -Verbose -PassThru