Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Using powershell to automate deployment of a new site

Vote:
 

Hi,

I'd like to use powershell to automate the deployment process of a new CMS site (with Commerce). I'm using the CMS 7 verstion and Commerce R3. The Deployment Center is good, but as we need to deploy on many environments, it could be nice to have a script to deploy all from scratch.

What I understood, is that you're already using powershell scripts "under the hood" to deploy using the Deployment Center, is that right?

I found the script "C:\Program Files (x86)\EPiServer\CommonFramework\7.0.844.1\Install\System Scripts\Install Site (SqlServer).ps1", I wanted to start with this script first.

First, I got problems trying to use this script, here's the error:

------------------------------------------------------------------------------------------------------------------------

PS C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Install\System Scripts> & ".\Install Site (No database).ps1" -sqlServerName "localhost" -seedName "EpiPopCellarDemo" -installAlloyTech $false
Add-PSSnapin : Cannot load Windows PowerShell snap-in EPiServer.Install.Common.1 because of the following error: Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\assembly\GAC_MSIL\EPiServerInstall.Common.1\v4.0_1.1.1239.0 \EPiServerInstall.Common.1.dll' or  of its dependencies. This assembly is built by a runtime newer the currently loaded runtime and cannot be loaded. At C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Install\System Scripts\Install Site (No database).ps1:29 char:14 
+ Add-PSSnapin <<<< EPiServer.Install.Common.1
+ CategoryInfo : InvalidArgument: (EPiServer.Install.Common.1:String) [Add-PSSnapin], PSSnapInException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

 

------------------------------------------------------------------------------------------------------------------------

 

I was using powershell (x86) to run the code. With the information I found here: http://world.episerver.com/Modules/Forum/Pages/thread.aspx?id=62190, I tried to install the snapin and add it.

For the installation:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "C:\Program Files (x86)\EPiServer\Shared\Install\EPiServerInstall.Common.1.dll"

And retrying to add the snapin I got that:

------------------------------------------------------------------------------------------------------------------------

PS C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Install\System Scripts> Add-PSSnapin EPiServer.Install.Common.1
Add-PSSnapin : Cannot load Windows PowerShell snap-in EPiServer.Install.Common.1 because of the following error: Could not load file or assembly 'file:///C:\Windows\Microsoft.Net\assembly\GAC_MSIL\EPiServerInstall.Common.1\v4.0_1.1.1239.0 __8fe83dea738b45b7\EPiServerInstall.Common.1.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
At line:1 char:13
+ Add-PSSnapin <<<< EPiServer.Install.Common.1
+ CategoryInfo : InvalidArgument: (EPiServer.Install.Common.1:String) [Add-PSSnapin], PSSnapInException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand

------------------------------------------------------------------------------------------------------------------------

Any idea how to solve this?

 

And secondly, any information to help me with an automated deployment process?

 

Thanks in advance for your help.

#69593
Mar 28, 2013 18:07
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.