Get-Item Problem

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.

you’re not passing the variable containing the file name to invoke-command

invoke-command -computername 'server' -authentication negotiatewithimplicitcredential -scriptblock {Get-Childitem D:\CLM_MDB\ -filter $clm -Recurse -force} -argumentlist $cim

Thanks for the reply! I tried to add the argument but it still sends over all recursed files.

Turns out I needed to put the read-host INTO the scriptblock. THX!