0

In a console application (.exe) I have below line that opens a site.

 site = new SPSite(targetServerURL);
 web = site.OpenWeb();

I am running exe using PowerShell as below from a non-SharePoint machine as below:-

$securePassword= ConvertTo-SecureString "mypassword" -AsPlainText -force

$cred = New-Object System.Management.Automation.PsCredential("domain\username",$securePassword)

Invoke-Command -Authentication credssp -Credential $cred -ComputerName machineA.FQDN.com `
-ScriptBlock { & 'c:\Test\MI_PORTAL_2_Demo\Installe.exe'}

It throws below exception:

The Web application at http://mysite.com could not be found. Verify that you have typed the URL correctly.

The console application is configured to use .net framework 3.5, Any CPU.

I can access the site(URL) locally. So site exists. PowerShell remoting is enables on all machines involved. And Sharepoint2010 farm is configured with kereberos.

Any idea why this error is thrown when executing it remotely?

5

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.