Hangi dosya sistemi ve yazıcı paylaşımları mevcuttur ve bunları kimler kullanabilir?

Womanne

Member
Bir dosya sistemi veya yazıcı sürümü hızla oluşturulur ve hızla unutulur. Sahipsiz paylaşımlar veya aşırı ayrıcalıklı paylaşımlar olmadığından emin olmak için aşağıdaki PowerShell betiğini kullanıyorum.


O sorar Get-WMI nesnesi Win32_Share uzak bir sistemde yayınlar. komut ile Get-ACL izin listesini alabilirsiniz.

Sorgulanacak bilgisayarların listesi bir metin dosyasından okunabilir,

$computerList = Get-Content "$psscriptrootcomputerliste.txt"

statik olarak sakla

$computerList = "PC1","PC2","PC3" # usw.

veya Active Directory’den okuyun:

(Get-ADComputer -Filter {OperatingSystem -like "*windows*"}).Name


Senaryo şuna benziyor

# Auflisten der auf mehreren Computern angelegten Dateisystem- und Druckerfreigaben
function Get-Share($computer)
{
$befehl = { Get-WMIobject Win32_Share | where { $_.description -ne "Default share" -and $_.name -ne "Admin$" -and $_.name -ne "IPC$" } }
$shares = invoke-command $befehl -computer $computer
$shareString = ""
foreach($s in $shares)
{
$shareString = $shareString + "$computer$($s.name)" + " -> " + $s.path + "`n"
$shareString = $shareString + "Beschreibung: " + $s.description + "`n"
try
{
$acl = Get-ACL "$computer$($s.name)" -ErrorAction stop
foreach($ace in $acl)
{
foreach($a in $ace.access)
{
$shareString = $shareString + $a.AccessControlType.ToString() + ": " + $a.IdentityReference + " -> " + $a.FileSystemRights.ToString() + "`n"
}
}
}
catch
{
$shareString = $shareString + "Kann ACL nicht lesen!`n"
}
$shareString = $shareString + "`n"
}
return $shareString
}
$computerList = (Get-ADComputer -Filter {OperatingSystem -like "*windows*"}).Name #Get-Content "$psscriptrootcomputerliste.txt"
foreach($c in $computerList) { get-Share $c }


()






Haberin Sonu
 
Üst