我嘗試撰寫一個 PowerShell 腳本,在服務器上輸出打開的 SMB 連接,以便我可以看到誰在使用服務器以及使用哪個目錄。為此,我發現 cmdletget-smbopenfile看起來很方便。
檔案https://learn.microsoft.com/de-de/powershell/module/smbshare/Get-SmbOpenFile?view=windowsserver2022-ps說get-smbopenfile輸出包含屬性ClientComputerName,ClientUserName但在我的盒子(Windows Server 2022)上只有屬性回傳的FileId是SessionId和Path。我不能讓它回傳任何其他屬性。檔案似乎對此一清二楚。我錯過了什么?
uj5u.com熱心網友回復:
get-smbopenfile | fl *查看所有內容,否則 powershell 命令使用具有默認視圖的格式檔案。所有命令都是這樣的。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
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/531501.html
標籤:电源外壳
上一篇:函式單獨作業,但不在腳本內
