使用 net share 命令,我可以看到所有共享,但是如何显示所有共享的用户?
C:\Users\erx9adm>net share
Share name Resource Remark
----------------------------------------------------
ADMIN$ C:\Windows Remote
F$ F:\ Default
E$ E:\ Default
IPC$ Remote
C$ C:\ Default
Arthur F:\ftp\opentext\SAS\ops_analytics\integ
ASM_CustomerAccessibleData
F:\interfaces
Billing F:\ftp\opentext\Billing
BillingInvoiceReport
F:\ftp\opentext\BillingInvoiceReport
BillPrint_AFP_correspondence
F:\ftp\opentext\BillPrint_AFP_correspon
BillPrint_IR_letters
F:\ftp\opentext\BillPrint_IR_letters
BPview_load F:\ftp\opentext\BPview_load
BW F:\ftp\opentext\BW
CBCI_File F:\ftp\opentext\tmp\CBCI_File
答案1
PowerShell 的Get-SmbShareAccess
cmdlet 获取给定共享的共享访问控制列表。 可以将其与Get-SmbShare
(PowerShell 等效项net share
)结合使用以获取每个共享的 ACL:
Get-SmbShare | select -pv s | % { Get-SmbShareAccess $s.Name | select Name, @{n='Description'; e={$s.Description}}, @{n='Path'; e={$s.Path}}, AccountName, AccessControlType, AccessRight } | Format-Table
我的机器上的输出:
Name Description Path AccountName AccessControlType AccessRight
---- ----------- ---- ----------- ----------------- -----------
ADMIN$ Remote Admin C:\WINDOWS BUILTIN\Administrators Allow Full
ADMIN$ Remote Admin C:\WINDOWS BUILTIN\Backup Operators Allow Full
ADMIN$ Remote Admin C:\WINDOWS NT AUTHORITY\INTERACTIVE Allow Full
C$ Default share C:\ BUILTIN\Administrators Allow Full
C$ Default share C:\ BUILTIN\Backup Operators Allow Full
C$ Default share C:\ NT AUTHORITY\INTERACTIVE Allow Full
FileHistory1 D:\FileHistory *S-1-5-21-[redacted]-1003 Allow Full
IPC$ Remote IPC BUILTIN\Administrators Allow Full
IPC$ Remote IPC BUILTIN\Backup Operators Allow Full
IPC$ Remote IPC NT AUTHORITY\INTERACTIVE Allow Full
print$ Printer Drivers C:\WINDOWS\system32\spool\drivers Everyone Allow Read
print$ Printer Drivers C:\WINDOWS\system32\spool\drivers BUILTIN\Administrators Allow Full
share C:\share Everyone Allow Full
共享可以列出多次,每个安全主体授予或拒绝访问权限一个。