21. Juli 2014 17:05
function Export-NAVApplicationObjectFileFlexiServer
{
[CmdletBinding()]param (
[String]$WorkingFolder,
[String]$ExportFile,
[String]$Server,
[String]$Database,
[String]$Filter )
$LogFile = "$WorkingFolder\Log_$ExportFile"
$ExportFile = "$WorkingFolder\$ExportFile"
if (Test-Path "$WorkingFolder\navcommandresult.txt") {Remove-Item "$WorkingFolder\navcommandresult.txt"}
if (test-path $ExportFile) {remove-item $ExportFile}
$NAVFolder = '"C:\Program Files (x86)\Microsoft Dynamics NAV\71\RoleTailored Client'
$exportfinsqlcommand = """$NAVFolder\finsql.exe"" command=exportobjects,file=$ExportFile,servername=$Server,database=$Database,Logfile=$LogFile"
if ($Filter -ne ""){$exportfinsqlcommand = "$exportfinsqlcommand,filter=$Filter"}
$Command = $exportfinsqlcommand
Write-Debug $Command
cmd /c $Command
$ExportFileExists = Test-Path "$ExportFile"
If (-not $ExportFileExists) {
write-error "Error on exporting to $ExportFile. Look at the information below."
if (Test-Path "$WorkingFolder\navcommandresult.txt"){Type "$WorkingFolder\navcommandresult.txt"}
if (Test-Path $LogFile) {type $LogFile}
}
else{
$NAVObjectFile = Get-ChildItem $ExportFile
if ($NAVObjectFile.Length -eq 0) { Remove-Item $NAVObjectFile }
if (Test-Path "$WorkingFolder\navcommandresult.txt") { Type "$WorkingFolder\navcommandresult.txt"}
}
}
Export-NAVApplicationObjectFileFlexiServer `
-WorkingFolder 'C:\Merge\Export' `
-ExportFile '<MyExportFileName>.txt' `
-Server '<MyServername>' `
-Database '<MyDatabaseName>' `
-Filter 'Version List="<MyFilter>"'
$DebugPreference = "Continue"
22. Juli 2014 15:12
# Anlegen der Standard-Mergeordner im aktuellen Verzeichnis
function CreateMergeFolders
{
md ORIGINAL
md MODIFIED
md TARGET
md RESULT
}
Set-Alias cmf CreateMergeFolders
PS C:\Scripts> get-help mkdir
NAME
New-Item
SYNTAX
New-Item [-Path] <string[]> [-ItemType <string>] [-Value <Object>] [-Force] [-Credential
<pscredential>] [-WhatIf] [-Confirm] [-UseTransaction] [<CommonParameters>]
New-Item [[-Path] <string[]>] -Name <string> [-ItemType <string>] [-Value <Object>] [-Force]
[-Credential <pscredential>] [-WhatIf] [-Confirm] [-UseTransaction] [<CommonParameters>]
ALIASE
ni
15. Oktober 2014 15:50
## NAV 2015
function Export-NAV80ApplicationObjectFileFlexiServer
{
[CmdletBinding()]param (
[String]$WorkingFolder,
[String]$ExportFile,
[String]$Server,
[String]$Database,
[String]$Filter )
$LogFile = "$WorkingFolder\Log_$ExportFile"
$ExportFile = "$WorkingFolder\$ExportFile"
if (Test-Path "$WorkingFolder\navcommandresult.txt") {Remove-Item "$WorkingFolder\navcommandresult.txt"}
if (test-path $ExportFile) {remove-item $ExportFile}
$NAVFolder = '"C:\Program Files (x86)\Microsoft Dynamics NAV\80\RoleTailored Client'
$exportfinsqlcommand = """$NAVFolder\finsql.exe"" command=exportobjects,file=$ExportFile,servername=$Server,database=$Database,Logfile=$LogFile"
if ($Filter -ne ""){$exportfinsqlcommand = "$exportfinsqlcommand,filter=$Filter"}
$Command = $exportfinsqlcommand
Write-Debug $Command
cmd /c $Command
$ExportFileExists = Test-Path "$ExportFile"
If (-not $ExportFileExists) {
write-error "Error on exporting to $ExportFile. Look at the information below."
if (Test-Path "$WorkingFolder\navcommandresult.txt"){Type "$WorkingFolder\navcommandresult.txt"}
if (Test-Path $LogFile) {type $LogFile}
}
else{
$NAVObjectFile = Get-ChildItem $ExportFile
if ($NAVObjectFile.Length -eq 0) { Remove-Item $NAVObjectFile }
if (Test-Path "$WorkingFolder\navcommandresult.txt") { Type "$WorkingFolder\navcommandresult.txt"}
}
}
notepad $profile
20. Oktober 2014 11:54
Export-NAVApplicationObject -DatabaseName NAV800DE_RTM -Path C:\Upgrade\NAV800DEAllObjects.txt -DatabaseServer KK-NB\NAVDEMO -ExportTxtSkipUnlicensed -Filter "Version List = *MyFilter*" -Force
Export-NAVApplicationObject : : [6146865] The NAV710DE_UR11 database on the KK-NB\NAVDEMO server
must be converted before you can use it with this version of the Microsoft Dynamics NAV Development
Environment.
If you convert the database, you will no longer be able to open it with older versions of Microsoft
Dynamics NAV Development Environment.
We strongly recommended that you make a database or transaction log backup in SQL Server before the
conversion.
Choose the OK button to convert the database, or choose the Cancel button to exit.
20. Oktober 2014 13:13
Kowa hat geschrieben:Für ältere Datenbanken (NAV 2013 R2) ist der leider nicht verwendbar, da kommt die übliche Konvertierungswarnung. Der "OK button" fehlt aber ohnehin in der PowerShell .
- Code:
Export-NAVApplicationObject : : [6146865] The NAV710DE_UR11 database on the KK-NB\NAVDEMO server
must be converted before you can use it with this version of the Microsoft Dynamics NAV Development
Environment.
If you convert the database, you will no longer be able to open it with older versions of Microsoft
Dynamics NAV Development Environment.
We strongly recommended that you make a database or transaction log backup in SQL Server before the
conversion.
Choose the OK button to convert the database, or choose the Cancel button to exit.
20. Oktober 2014 13:45
winfy hat geschrieben:Aha, also geht das dann doch nicht ab CU 9 NAV2013R2 (siehe PDF Seite 12)... ?
(Link)
10. Februar 2015 16:48