0

while running below script I'm getting error saying in valid script, not sure what the issue is.

Script:

Clear-Host

Import-Module -Name SPE -Force

$session = New-ScriptSession -Username admin -Password b -ConnectionUri https://dev.local/


Write-Host "SESSION" $session

Invoke-RemoteScript -Session $session -ScriptBlock { Get-User -id admin }

Error

SESSION @{SessionId=4e5dd26c-9f8f-40d5-96af-512d881f0dbc; Username=admin; PersistentSession=False; UseDefaultCredentials=False; Credential=; SharedSecret=; Connection
=System.Object[]; Password=b}
Invoke-RemoteScript : Server response: The specified script is invalid.
At line:10 char:1
+ Invoke-RemoteScript -Session $session -ScriptBlock { Get-User -id adm ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ConnectionError: (https://dev.local/:) [Write-Error], BadRequest
    + FullyQualifiedErrorId : System.Net.Http.HttpRequestException,Invoke-RemoteScript

Sitecore Powershell version

Name                           Value
----                           -----
PSVersion                      5.1.19041.1682
PSEdition                      Desktop
SitecoreVersion                10.2.0.6766
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
SPEVersion                     6.4.0.16859
BuildVersion                   10.0.19041.1682
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Windows Powershell

PS C:\WINDOWS\system32> Get-Module

ModuleType Version    Name                                ExportedCommands                                                                                                                                      
---------- -------    ----                                ----------------                                                                                                                                      
Script     1.0.0.0    ISE                                 {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}                                                                                                   
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}                                                                                    
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}                                                                                             
Script     6.4.0      SPE                                 {ConvertFrom-CliXml, ConvertTo-CliXml, Invoke-GenericMethod, Invoke-RemoteScript...}                                                                  
2
  • What version of SPE installed in Sitecore? What version of the SPE Remoting module? Jan 12 at 2:08
  • @MichaelWest updated the ticket. Jan 12 at 9:15

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.