Multitenancy HowTo-MoveCompanyToTenant Error with SQL 2012

postsauravpostsaurav Member Posts: 708
edited 2014-04-16 in NAV Three Tier
Hi all,

Please reply if anyone know about it.

Implementing Multitenancy in NAV 2013 R2 and SQL Server 2012.

When i am trying to run the Command -
HowTo-MoveCompanyToTenant -ServerInstance TEST -DatabaseServer S000 -FromDatabase 'HEAD' -CompanyName 'CHILD' -OldTenantName 'HEAD' -NewTenantName 'CHILD' -ServiceAccount 'NT AUTHORITY\NETWORK SERVICE' -RemoveCompanyWhenMoved

The Power shell is giving me error -

Invoke-Sqlcmd : Incorrect syntax near '-'.
At C:\Multitenancy\HowTo-MoveCompanyToTenant.ps1:112 char:9
+ Invoke-Sqlcmd -ServerInstance $DatabaseServer -Database master -Query $C ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-Sqlcmd], SqlPowerShellSqlExecutionException
+ FullyQualifiedErrorId : SqlError,Microsoft.SqlServer.Management.PowerShell.GetScriptCommand


Poweshell is Run as administrator.

And to add in it, the command is working fine with SQL Server 2008 R2.

I read there have been some changes in Invoke-SqlCmd in SQL SErver 2012 but there is no update for same in respect to Multitenancy Scripts. I also tried same with the Multitenancy script with Cummulative Update 6 for NAV 2013 R2.

Nothing seems to work.

Please suggest what changes i need to do in HowTo-MoveCompanyToTenant.ps1 so that it can get executed.

Thanks & Regards,
Saurav Dhyani

Do you Know this About NAV?


Connect - Twitter | Facebook | Google + | YouTube

Follow - Blog | Facebook Page | Google + Page
Sign In or Register to comment.