$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