//
you're reading...

Powershell

Powershell Connecting to remote server failed

I get this error message when I use Invoke-Command to execute a script block on a remote server.

image

Invoke-Command –Credential (Get-Credential) –ComputerName MyRemoteServer –ScriptBlock {Get-Date}

I set $PSSessionOption.NoMachineProfile=$true to fix the problem before executing Invoke-Command.

$PSSessionOption.NoMachineProfile=$true
Invoke-Command –Credential (Get-Credential) –ComputerName MyRemoteServer –ScriptBlock {Get-Date}