Hello,
Ican notsolve the problems launchscriptviaInvoke-Command.
PSRemoting on remote (target) host is enabled by:
Enable-PSRemoting-ForceSet-Item wsman:\localhost\client\trustedhosts*-Force
Invoke-Command launch script to target host, but only if I have RDP session to target host.
This command
Invoke-Command {Get-Service} -ComputerName $SERVER -Credential (Get-Credential) -Authentication Kerberos
or
Invoke-Command -ComputerName $Server -ScriptBlock {Get-Service}
if RDP session on target host closed, then I receive this error:
Connecting to remote server failed with the following error message : The WSMan service could not launch
a host process to process the given request. Make sure the WSMan provider host server and proxy are properly register
ed. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (:) [], PSRemotingTransportException
+ FullyQualifiedErrorId : PSSessionStateBroken
Additional information: Target server is a terminal server with roaming users profiles. Profiles are deleted after user logout