The problem is that you haven’t nested the functions; you’ve defined them on your local computer. The remote computer’s FUNCTION: drive doesn’t share the same memory space as your local computer, and so the functions don’t exist there.
It would probably be easier to define the functions, and whatever commands you want to run that use those functions, in a .ps1 file on your local computer. Then use -FilePath of Invoke-Command instead of -ScriptBlock, which will transmit the entire script file to the remote machine and then run that script there.
Thx for the answer.
Do you have a link for ‘a method for redefining external function inside scriptblock’. I’ve search for that, but don’t seem to get a hit that tells me how.