I’m trying to hit the Sitecore Webservices with the following Script:
The following function comes from Sitecore/system/Modules/PowerShell/Script Library/Platform/Functions/Remoting
function Set-SitecoreConfiguration {
[CmdletBinding()]
param(
[Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[string]$SitecoreHost,
[Parameter(Position=1, Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[string]$User,
[Parameter(Position=2, Mandatory=$true, ValueFromPipeline=$true)]
[ValidateNotNullOrEmpty()]
[string]$Password
)
$URI = $SitecoreHost + "/sitecore%20modules/PowerShell/Services/RemoteAutomation.asmx";
$GLOBAL:SpeRemoteProxy = New-WebServiceProxy -Uri $URI
$GLOBAL:SpeRemoteUser = $User;
$GLOBAL:SpeRemotePassword = $Password;
}
#Connect to SiteCore utilizing function above
Set-SitecoreConfiguration –SitecoreHost 'http://sitecorehostname' -User 'Admin' –Password 'b'
This fails with a 404. As you can see, the final URI is:
http://sitecorehostname/sitecore%20modules/PowerShell/Services/RemoteAutomation.asmx, which actually does exist in the directory structure of the website.
One directive that sitecorepowershell.gitbooks.io tells you to do is to update the following in C:\inetpub\wwwroot\SiteCoreSite\Website\App_Config\Include\Cognifide.Powershell.config:
(https://sitecorepowershell.gitbooks.io/sitecore-powershell-extensions/content/security.html)
<sitecore>
<powershell>
<services>
<restfulv1 enabled="true" />
<restfulv2 enabled="true" />
<remoting enabled="true" />
<fileDownload enabled="true" />
<fileUpload enabled="true" />
<mediaDownload enabled="true" />
<mediaUpload enabled="true" />
<handleDownload enabled="true " />
<client enabled="true" />
<execution enabled="true" />
</services>
</powershell>
</sitecore>
Even so, I get the following Powershell error:
New-WebServiceProxy : The request failed with HTTP status 404: Not Found. At C:\Scripts\SitecoreConnectionPOC.ps1:17 char:30 + $GLOBAL:SpeRemoteProxy = New-WebServiceProxy -Uri $URI + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (http://sitecorehostname...Automation.asmx:Uri) [New-WebServiceProxy], WebException + FullyQualifiedErrorId : WebException,Microsoft.PowerShell.Commands.NewWebServiceProxy
Any idea what the issue might be? Do we need to enable some sort of capability in Sitecore? I have SPE installed, fyi.