On a fresh Windows VM I installed powershell extensions module:
Install-Module SPE
Then I am trying to invoke a remote script on my sitecore instance:
$url = "https://my-sitecore.azurewebsites.net"
$session = New-ScriptSession -Username admin -Password b -ConnectionUri $url
Invoke-RemoteScript -Session $session -ScriptBlock { Write-Host "Foo" }
But it fails with
You cannot call a method on a null-valued expression. At C:\Program Files\WindowsPowerShell\Modules\SPE\6.0.0\Invoke-RemoteScript.ps1:344 char:21 + $taskResult.Content.ReadAsStringAsync().Result + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull
How can I fix it?