0

I try to write a PowerShell script that outputs open SMB connections on a server so that I can see who's working with the server and with which directory. For that, I found cmdlet get-smbopenfile which looks pretty handy.

The documentation https://learn.microsoft.com/de-de/powershell/module/smbshare/Get-SmbOpenFile?view=windowsserver2022-ps says that the get-smbopenfile output contains properties ClientComputerName and ClientUserName but on my box (Windows Server 2022) the only properties returned are FileId, SessionId and Path. I can't make it return any additional properties. The documentation seems to be crystal clear on that. What am I missing?

1
  • 1
    It might just be the default formatting file for the output type that hides the other properties by default. Are you seeing more properties if you pipe to output to Get-Member? eg. Get-SmbOpenFile |Get-Member -MemberType Properties Commented Nov 8, 2022 at 14:45

1 Answer 1

1

get-smbopenfile | fl * to see everything, otherwise powershell commands use a format file with a default view. All commands are like this. You can still reference any property, even without fl or format-list.

get-smbopenfile | select -first 1 | fl *

SmbInstance           : Default
ClientComputerName    : [::1]
ClientUserName        : AD\SERVER$
ClusterNodeName       :
ContinuouslyAvailable : False
Encrypted             : False
FileId                : 1546188227134
Locks                 : 0
Path                  : \eventlog
Permissions           : 1180064
ScopeName             : *
SessionId             : 1546188226562
ShareRelativePath     : eventlog
Signed                : False
PSComputerName        :
CimClass              : ROOT/Microsoft/Windows/SMB:MSFT_SmbOpenFile
CimInstanceProperties : {ClientComputerName, ClientUserName, ClusterNodeName, ContinuouslyAvailable...}
CimSystemProperties   : Microsoft.Management.Infrastructure.CimSystemProperties
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.