You're trying to use the PowerShell cmdlet Get-SMBOpenFile to show a list of open files on your Windows system, but it's returning nothing. Let's go through this step-by-step to help you understand what might be happening and how to fix or work around it.
🔍 Understanding Get-SMBOpenFile
The Get-SMBOpenFile cmdlet is specifically for SMB (Server Message Block) file shares. It shows files that are currently open by remote clients connecting to your machine via SMB (i.e., someone accessing shared folders on your computer from another machine on the network).
This does not show files opened locally by processes or applications on your own machine.
So, if you're expecting to see local open files (e.g., files opened by Notepad, Excel, etc.), this is not the right tool.
✅ If You Want to See SMB Open Files
1. Run as Administrator
You need elevated privileges to run this command successfully.
Open PowerShell as Administrator
Then run:
powershell
Get-SMBOpenFile
If you're the only user and no one else is connected to your machine's shares, it will return nothing — and that's normal.
2. Check if File Sharing is Enabled
Make sure your machine has file sharing enabled and that it's sharing at least one folder. If no shares exist, there's nothing for this command to report.
3. Check SMB Server Status
Ensure the Server service is running:
powershell
Get-Service -Name "Server"
It should be in Running status. If not, start it with:
powershell
Start-Service -Name "Server"
🧪 Example Output
If someone is connected and has a file open, you’ll see something like this:
text
FileId : 65536
FileName : \Shares\Public\report.docx
ShareName : Public
ClientComputerName : 192.168.1.100
ClientUserName : DOMAIN\User
OpenTime : 4/5/2025 10:00:00 AM
❓ If You Want to See Locally Opened Files
Then Get-SMBOpenFile is not the right tool. You need to use something like:
Get-WmiObject -Query "SELECT * FROM Win32_Process WHERE Name = 'explorer.exe'" | Select-Object -ExpandProperty Handle
But WMI doesn't directly show file handles. Handle.exe is the most reliable tool for this.
🧰 Summary
Goal
Recommended Tool
See SMB remote open files
Get-SMBOpenFile (run as admin)
See local open files/processes
Use handle.exe from Sysinternals
Ensure SMB sharing is working
Check "Server" service and shared folders
📝 Final Tip
If you're using Windows 10 or 11 (not Windows Server), the Get-SMBOpenFile cmdlet is still available if you have the "SMB Share - Windows Server" optional feature installed, but SMB server functionality is limited or disabled by default on client OSes.