You really need to clarify what your use case is and how you need to accomplish. SO, we need details on the use case / goal in order to assist.
However, based on what is here.
All scriptblocks must be enclosed in {}.
So, your syntax is not correct. Also, though you are doing this, in the script block, you are not telling it how to run.
So, adding the {} around your string, all that will come back is the string…
Invoke-Command -ComputerName ‘UIASFS02’ -ScriptBlock {‘\p1\c$\scripts\script1.ps1’}
\p1\c$\scripts\script1.ps1
Even is you passed it this way…
Invoke-Command -ComputerName ‘UIASFS02’ -ScriptBlock {powershell ‘\p1\c$\scripts\script1.ps1’}
… it will fail with…
\p1\c$\scripts\script1.ps1 : The term ‘\p1\c$\scripts\script1.ps1’ is not recognized as the name of a
+ CategoryInfo : NotSpecified: (\p1\c$\s… the name of a :String) , RemoteException
+ FullyQualifiedErrorId : NativeCommandError
+ PSComputerName : UIASFS02
… Why, because that script file is not available for use in this fashion.
Secondly, this looks like you are calling a remote computer from your local workstation and using that computer to run a script on another computer. You cannot to this by default as this is a Kerberos double hop authentication issue.
See this article for details…
PowerShell Remoting Kerberos Double Hop Solved Securely
So, even if you told this script how to run, you’d get this error, because of the double hop.
Invoke-Command -ComputerName UIASFS02 -ScriptBlock {Start-Process \p1\c$\scripts\script1.ps1}
This command cannot be run due to the error: Access is denied.
+ CategoryInfo : InvalidOperation: ( [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
+ PSComputerName : UIASFS02
Lastly, you have to be aware of how to call commands and remote scripts as there are special characters that you can use, that must be escaped before what follows them will be useful.
See the help files for …
about_special_characters
‘docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_special_characters?view=powershell-5.1’
about_escape_characters
‘docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_escape_characters?view=powershell-5.1’