Przeszukiwanie plików z dostępem do odczytu na zasobach - powershell

blaszczakm.blogspot.com 4 lat temu
$REMOTE_HOST = "172.21.56.235"

$FILE_TYPES = "*.pst, *.conf"

net view \\$REMOTE_HOST\ |
ForEach-Object {
$path = [regex]::match($_, '(.*) Dysk').Groups[1].Value.Trim()

if ($path -ne "") {
Write-Host ("### PATH: " + $path)
Get-ChildItem -Path \\$REMOTE_HOST\$path -Include $FILE_TYPES -Recurse -ErrorAction Ignore |
ForEach-Object {
Try {
[System.IO.File]::OpenRead($_.FullName).Close()
Write-Host $_.FullName
}
Catch {
#Write-Host ("Niet: " + $_.FullName)
}
}
}
}



//Autor: hagier
Idź do oryginalnego materiału