2

I want to migrate list items held in our dev sharepoint farm to site collection hosted on our live farm. Ok I have RDPed onto the server and I am running ISE as administrator I do another account I used to install sharepoint that is slightly more permissions I could try

#SourceWebURL is the URL of the web which contains the source list
$SourceWebURL = "http://dev/sites/sourcelists"


#DestinationWebURL is the URL of the web in which you want to transfer your documents
$DestinationWebURL = "https://corporate.companydomain.com"



 #DestinationWebURL is the URL of the web in which you want to transfer your documents
 $sWeb = Get-SPWeb $SourceWebURL


 #THIS GIVES THE ERROR WHEN RUN FROM THE DEV Sever
 $dWeb = Get-SPWeb $DestinationWebURL

Get-SPWeb : Cannot find an SPSite object that contains the following Id or Url: Get-SPWeb : Cannot find an SPSite object that contains the following Id or Url: https://corporate.companydomain.com. At C:\dev\ps\Admin\CopyFilesAndFolders.ps1:34 char:9 + $dWeb = Get-SPWeb $DestinationWebURL + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share....SPCmdletGetWeb:SPCmdletGetWeb) [Get-SPWeb], SPCmdletPipeBindException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetWeb

At C:\dev\ps\Admin\CopyFilesAndFolders.ps1:34 char:9 + $dWeb = Get-SPWeb $DestinationWebURL + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (Microsoft.Share....SPCmdletGetWeb:SPCmdletGetWeb) [Get-SPWeb], SPCmdletPipeBindException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletGetWeb

Now until we get a local site security policy change on AD when I open "https://corporate.companydomain.com" on a browser, I am presented with a login dialog box so this may be a factor. Just wondered if anyone seen this or able to "RunAs" Get-SPWeb to get passed the Login box.

2
  • Can You connect this site not by HTTPS?
    – Gennady G
    Jan 7, 2015 at 18:30
  • Imho if 'Get-SPWeb' does not use web-services, You should launch it on host
    – Gennady G
    Jan 7, 2015 at 19:09

1 Answer 1

1

That will only work with the local instance or machines joined to same domain. You can look at remoting but you need to configure it to work with non-domain machine.

For instance -

If you want run from Dev.com and connect to Prod.com you have to set your SharePoint servers on Prod to trust the machine in the Dev domain to run PowerShell command. To add server to trusted host list you use this command.

 Set-Item -Path WSMan:\localhost\Client\TrustedHosts -Value 'server.dev.com'

There are some other requirements such as remote ports and if you will remote over HTTPS (I actually thing that is a reimbursement) you need to configure SSL certs. I'm quite sure there may be some other things that may trip you up such as exporting objects between sessions.

Alternatives are to use the API's and create a custom console app or call them from PowerShell.

1
  • Hi @Jesus ... interesting I hadn't thought of that. Got talking to Paul Hunt from #suguk on FB last night who concurs with your last point so PS + CSOM looks the way to go Jan 8, 2015 at 9:02

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.