I was trying to add new version for each item in sitecore:
$root = "master:\content\home"
@(Get-Item -Path $root) + @(Get-ChildItem -Path $root) -Recurse |
Add-ItemLanguage -Language "en-us" -TargetLanguage "en-ca" -IfExist Skip
I found the above code from sitecore community, but while executing getting the following error:
At line:2 char:56
+ @(Get-Item -Path $root) + @(Get-ChildItem -Path $root) -Recurse |
+ ~~~~~~~~
Unexpected token '-Recurse' in expression or statement.
Of type: System.Management.Automation.ParseException
Stack trace:
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
at Cognifide.PowerShell.Core.Host.ScriptSession.ExecuteCommand(Boolean stringOutput, Boolean marshallResults)
at Cognifide.PowerShell.Core.Host.ScriptSession.<>c__DisplayClass150_0.b__0()
at Cognifide.PowerShell.Core.Utility.SpeTimer.Measure[T](String message, Boolean log, Func`1 action)
at Cognifide.PowerShell.Core.Host.ScriptSession.ExecuteScriptPart(String script, Boolean stringOutput, Boolean internalScript, Boolean marshalResults)
at Cognifide.PowerShell.Core.Host.ScriptSession.ExecuteScriptPart(String script, Boolean stringOutput, Boolean internalScript)
at Cognifide.PowerShell.Core.Host.ScriptSession.ExecuteScriptPart(String script)
at Cognifide.PowerShell.Client.Applications.PowerShellIse.ExecuteInternal(ScriptSession scriptSession, String script)
at Cognifide.PowerShell.Client.Applications.ScriptRunner.Run()