# Define an array with the server shares to look ing
$server_shares = @("\\server1\share1","\\server2\share2")
# Local repository to collect the files into
$local_repo = "$env:USERNAME\Documents\Repo"
$pattern = "*FILENAME*.txt*"
$map_drive = ""
# Create the repo if it doesn't exist
If (-not (Test-Path -Path $local_repo))
{
New-Item -Path $local_repo -ItemType Directory
}
# D - Z
# Find an unused drive letter
$char_index = 68..91
foreach($index in $char_index)
{
$letter = [char]$index
if (-not (Test-Path "$($letter):\"))
{
$map_drive = "$($letter)"
break
}
}
# Connect to each share and find files to copy...