Reputation: 31
I am trying to deploy a sharepoint solution with a sharepoint script, with this approach:
First i test the environment, using windows powershell console
New-PSSession -ComputerName developmentserver01
Enter-PSSession -computername developmentserver01
d:
cd d:\deploymentscripts
.\deploysharepoint.ps1
Then i start the automation:
1.- TFS runs a build that call at the end to "deploy.ps1" locally in the build server. ---> this is working.
2.- desploy1.ps1 copy the drop files to the development environment developmentserver01 shared folder.
3.- after copy the files, deploy1.ps1 connet with the development environment machine developmentserver01 using remote connection commands from powershell -->this is working.
4.- this step fails, in this step i try to execute the deployment script deploySharepoint.ps1 that has copied in the development environment machine in the step 2. First using commands inside the script like in the powershell console, but i see that the commands are running inside the TFS build machine not in the machine that i connected whit remote connection
d:
cd d:\deploymentscripts
.\deploysharepoint.ps1
Later using different options (invoke-command, ...) only this optionk works:
Invoke-Command -computername developmentserver01 -scriptblock{d:\DeploymentScripts\deploysharepoint.ps1 -solutionNames @("parameter1")}
The problem it´s that i think that invoke-command don´t work like the commands using powershell console , because the script show the error that the user don´t haver permissions for accesing the Farm of sharepoint.
If i run the script with remote session in a power shell console as show at the beginning of the post, all things work fine.
How can i run the remote script deploysharepoint.ps1 with remote session from the script desploy.ps1, like using powershell console?
Upvotes: 3
Views: 1880
Reputation: 109180
invoke-command
is the right answer. But:
the script show the error that the user don´t haver permissions for accesing the Farm of sharepoint.
If the3 script is being invoked (locally or remotely) by the TFS Build's user account, then that account is used to determine permissions.
So either change the account used to run the build to one that has the right SharePoint permissions, or give the TFS Build account the necessary permission.
Upvotes: 1