November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Could it be that you have not loaded the snapin containing the cmdlet? If so try this:
# Load the EPiServer Common snapin if required
$snapIn = Get-PSSnapin -Name EPiServer.Install.Common.1 -ErrorAction SilentlyContinue
if ($snapIn -eq $null)
{
Add-PSSnapin EPiServer.Install.Common.1
}
Unfortunately not. :)
Here is the output of a new Powershell session:
PS D:\> Add-PSSnapin EPiServer.Install.Common.1
PS D:\> Add-PSSnapin EPiServer.Install.CMS.6.1.379.0
PS D:\> Get-EPiVersion -MapPath "D:\Websites\Site"
Get-EPiVersion : Object reference not set to an instance of an object.
At line:1 char:15
+ Get-EPiVersion <<<< -MapPath "D:\Websites\Site"
+ CategoryInfo : NotSpecified: (:) [Get-EPiVersion], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,EPiServer.Install.Common.Cmdlets.GetVersionCmdlet
I get the same results both on my local development machine, and the production servers on EverWeb.
Ok, I just looked at the sourcecode for the cmdLet and it expects the foldername to be in "version" format, so you should be able to call it something like:
Get-EPiVersion -MapPath "C:\Program Files (x86)\EPiServer\CMS\6.1.379.0"
Doh! I din't even consider using that directory as the directory for the commandlet... Thank you!!
Now, the question is - where can I find the Upgrade-EPiRemapDDSTypes commandlet?
That should be in the EPiServer.Framework snapin
$snapIn = Get-PSSnapin -Name EPiServer.Framework.Install.6.2.267.1 -ErrorAction SilentlyContinue
if ($snapIn -eq $null)
{
Add-PSSnapin EPiServer.Framework.Install.6.2.267.1
}
Hmm... Which DLL do I need to run InstallUtil on to be able to add that snap-in?
That was my guess, but I can't find that file on my system. It IS, however, installed in the GAC, but Powershell doesn't seem to find it.
I tried downloading the installation for EPiServer CMS 6 R2 and extracted the contents of EPiServer.Framework.msi, and there I found EPiServer.Framework.Install, which I renamed to EPiServer.Framework.Install.dll. However, when trying to install this dll, InstallUtil says it doesn't have any public installers.
Perhaps a better solution for me would be to take code for EPiServer.Framework.Install.Upgrade.RemapDDSType and add that to my project and run it from there instead? For unknown reasons, I need to remap EPiServer.Core,.PageObject in the DDS.
Being as I were unable to remap with PowerShell, I added a call to the method below in my Global.asax.cs Application_Start(). This only does the remapping thought - not any property-renaming:
private void ReMapType(string _type)
{
Type type = TypeResolver.GetType(_type);
if (type != null)
{
string storeNameForType = DynamicDataStoreFactory.Instance.GetStoreNameForType(type);
if (!string.IsNullOrEmpty(storeNameForType))
{
StoreDefinition definition = StoreDefinition.Get(storeNameForType);
if (definition != null)
{
definition.Remap(type);
definition.CommitChanges();
}
}
}
}
You have to reference EPiServer.Data.dll as well.
That's kind of what I did as well, but I put it in an IInitializableModule.
I also added this:
foreach (var storeDefinition in StoreDefinition.GetAll())
{
foreach (var propertyMap in storeDefinition.AllMappings)
{
storeDefinition.Remap(propertyMap.PropertyType);
}
storeDefinition.CommitChanges();
}
Hi,
I'm trying to run Powershell commands for EPiServer, to upgrade the DDS. When issuing Get-EPiVersion I get the following error:
PS D:\> Get-EPiVersion -MapPath "D:\Websites\Site"
Get-EPiVersion : Object reference not set to an instance of an object.
At line:1 char:15
+ Get-EPiVersion <<<< -MapPath "D:\Websites\Site"
+ CategoryInfo : NotSpecified: (:) [Get-EPiVersion], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,EPiServer.Install.Common.Cmdlets.GetVersionCmdlet
I'm running Powershell versions 2 and 3 (on two different computers), and EPiServer 6.1.379.502.