I have a custom module with my own functions. I do not want to install these modules on the remote machine. So I figured a way to pass the function reference and not a call to the function. Here is the working command:
Because the function: drive on the remote server wouldn’t contain your function. Normally whatever is in that script block is passed to the remote machine without interpretation, so the remote machine runs it.
The $ is PowerShell’s execution operator; it executes the script block on your machine, and the results of that - now containing the function - are sent to the remote machine.
The ${} is an escape sequence that you can use to call a variables that contains characters that are not normally allowed in variable names. ( we had a lot of fun with this in here jakubjares.com ) The function: is a way of accessing functions via variables, much like doing $env:computername ( or in your case ${env:computername} )
What you are doing is equivalent of (Get-Command Set-RPSQLFirewall).Definition
Thanks for the info. I really like this feature, a great way to get things done without having custom modules installed on the servers being provisioned.