I am trying to create a user input script whereby the user inputs the filename and the script will retrieve it on a remote server. The problem I am having is that the script keeps recursing through all files even though the specific file name is given. Here is the script:
$clm = Read-Host -prompt “Please input claim number (i.e. CLM123…)”
Write-Host “Contacting Server to find file”
invoke-command -computername ‘server’ -authentication negotiatewithimplicitcredential -scriptblock {Get-Childitem D:\CLM_MDB\ -filter $clm -Recurse -force}
Any help appreciated. The goal is to eventually just get the one file and move it to another server.