Import-NAVEncryptionKey : A positional parameter cannot be found that accepts argument '-

Hi Expert.

Recently we need create NLB load balance, we create two new servers,and get ready to create new NAS instance with the same key of the server 1, But when i finished the server 1, and exported the key ,then import to the server 2, use the command below

PS C:\Windows\system32> Import-NAVEncryptionKey -ServerInstance DynamicsNAV90 -KeyPath “C:\Keys\nav.key” - ApplicationDa
tabaseServer abiewaaaa.database.chinacloudapi.cn -ApplicationDatabaseName NavApp -Password (Get-Credential).Password

But I got the error below

Import-NAVEncryptionKey : A positional parameter cannot be found that accepts argument ‘-’.
At line:1 char:1

  • Import-NAVEncryptionKey -ServerInstance DynamicsNAV90 -KeyPath "C:\Ke …
  • CategoryInfo : InvalidArgument: (:slight_smile: [Import-NAVEncryptionKey], ParameterBindingException
  • FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.Dynamics.Nav.Management.Cmdlets.ImportNavEncryptio
    nKey

Any suggestion will be warmly appriciated.

Gary.

I got it:

when you create the first instance with database credentials, new key is generated and written in the database, so when you create new instance a new key is generated and written to database, because of this the first instance will stop because of missmatch key

What should you do

Delete the generated key from the second instance,
Location of the key

C:\ProgramData\Microsoft\Microsoft Dynamics NAV\100\Server\Keys

Export the key from the first instance

Export-NAVEncryptionKey -ServerInstance DynamicsNAV -KeyPath "C:\Keys\nav.key"

Import exported key in the second instance
You must provide database credentials in the -ApplicationDatabaseCredentials parameter

$Credential = (New-Object PSCredential -ArgumentList ‘‘,(ConvertTo-SecureString -AsPlainText -Force ‘‘))

Import-NAVEncryptionKey -ServerInstance DynamicsNAV -ApplicationDatabaseServer
-ApplicationDatabaseCredentials $Credential -ApplicationDatabaseName -KeyPath