如何部署自动MicrosoftDynamicsNAV
小编给大家分享一下如何部署自动Microsoft Dynamics NAV,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
成都创新互联服务项目包括垦利网站建设、垦利网站制作、垦利网页制作以及垦利网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,垦利网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到垦利省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
背景:
客户在以下情况下会增加一个新的Microsoft Dynamics NAV系统
--新建一个分支机构
--新建一系列测试
--开始一个新的财务年度
--等等
在实践阶段一个“新的Microsoft Dynamics NAV系统”可以使一个新的Microsoft Dynamics NAV 实例,一个database,一个company或者是一个tenant。为了简化介绍我们重用现有的Microsoft Dynamics NAV Service创建我们的新的database。
准备工作:
我们使用import-module sqlps.来导入SQLServer的PowerShell。安装SQLServer的时候提供了SQLPS,但是不安装SQL也可以获得该module。
如果在运行PS的机器上没有安装SQLSever,可以按照下面的地址安装Microsoft SQL Server 2012Feature Pack:
http://www.microsoft.com/en-us/download/details.aspx?id=29065
以下是代码
#准备工作 $MyNAVServerName = "DynamicsNAV80" $MySQLServerName = "." $MyNewCustomerName = "NewCustomer" $MyNewDatabaseName = "NewCustomerDatabase" Set-ExecutionPolicy unrestricted import-module "C:\Program Files\Microsoft Dynamics NAV\80\Service\NavAdminTool.ps1" Push-Location #jump back to standard prompt with pop-location import-module sqlps #ignore any warnings you may get #Restore SQL db (NAV demo db) #Relocate database files http://stackoverflow.com/questions/26400752/cannot-bind-relocatefile-when-using-restore-sqldatabase-cmdlet $mdf = New-Object Microsoft.SqlServer.Management.Smo.RelocateFile("Demo Database NAV (8-0)_Data", "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\DB_Data_$MyNewCustomerName.mdf") $ldf = New-Object Microsoft.SqlServer.Management.Smo.RelocateFile("Demo Database NAV (8-0)_Log", "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\DB_Log_$MyNewCustomerName.ldf") restore-SqlDatabase -ServerInstance $MySQLServerName ` -Database $MyNewDatabaseName ` -BackupFile "C:\NAVDVD\SQLDemoDatabase\CommonAppData\Microsoft\Microsoft Dynamics NAV\80\Database\Demo Database NAV (8-0).bak" ` -ReplaceDatabase ` -RelocateFile @($mdf,$ldf) #Set network service as dbo $CreateServiceAccountUser = "CREATE USER [NT AUTHORITY\NETWORK SERVICE] FOR LOGIN [NT AUTHORITY\NETWORK SERVICE]" Invoke-Sqlcmd -ServerInstance $MySQLServerName -Database $MyNewDatabaseName -Query $CreateServiceAccountUser$AddServiceAccountAsDbo = "exec sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE'" Invoke-Sqlcmd -ServerInstance $MySQLServerName -Database $MyNewDatabaseName -Query $AddServiceAccountAsDbo pop-location # Finished with SQL commands so popping back to normal PS prompt #For NAV 2013(R2), to convert the database to latest executable version. #For NAV 2015 we don't need this (in fact we don't have the Invoke-DatabaseConversion cmdlet). import-module "C:\PSscripts\Upgrade\Cmdlets\NAVUpgradeCmdlets.psm1" Invoke-NAVDatabaseConversion -DatabaseServer localhost -DatabaseName "Demo Database NAV (7-1)" -FinSqlExeFile "C:\Program Files\Microsoft Dynamics NAV\71\Service\finsql.exe" #At this point the next steps depend on whether we want a new NAV Service, connect to an existing one, etc. Here we just reuse existing NAV Service #Configure then restart the service and get status Set-NAVServerConfiguration $MyNAVServerName -KeyName DatabaseName -KeyValue $MyNewDatabaseName Set-NAVServerInstance $MyNAVServerName -restart Get-NAVServerInstance $MyNAVServerName
以上是“如何部署自动Microsoft Dynamics NAV”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注创新互联行业资讯频道!
名称栏目:如何部署自动MicrosoftDynamicsNAV
转载来于:http://pwwzsj.com/article/peddei.html