ScriptBlock doesn't work with variables

@thelmomauleon Welcome to PowerShell.org forums.

@tonyd has provided the right documentation to understand how the variable thing works in a remote execution, in addition Get-SmbShareAccess Cannot validate argument on parameter ‘Name’ - PowerShell Help - PowerShell Forums

Will also help you as it has is a similar thread.