Dazu den DVD-Ordner im Explorer mit der rechten Maustaste bei gedrückter Umschalttaste anklicken, dann im Kontextmenü "Als Pfad kopieren" auswählen.
Im PowerShell ISE die Funktion aufrufen und den Pfad als Parameter über die Zwischenablage einfügen. Das Backup erscheint dann kurze Zeit später nach Abschluss des Kopiervorgangs.
Die Beispielfunktion ist fĂĽr NAV 2015, fĂĽr andere Versionen den Backup-Pfad anpassen.
Damit die Funktion schnell griffbereit ist, noch mit einem kurzen Alias versehen und alles in der Profildatei hinterlegen.
- Code: Alles auswählen
function DigUpDatabase80Backup
{
$BasicPath = resolve-path $args
$TargetPath = (get-item $args).parent.FullName
$BackupPath = '\SQLDemoDatabase\CommonAppData\Microsoft\Microsoft Dynamics NAV\80\Database\Demo Database NAV (8-0).bak'
$Fullpath = [string]::Concat($BasicPath,$BackupPath)
Copy-Item -path $FullPath -Destination $TargetPath
Write-Host "Backup file copied to $TargetPath"
}
Wenn die Datei nicht kopiert, sondern verschoben werden soll, einfach Move-Item statt Copy-Item verwenden.
FĂĽr NAV 2013 R2
- Code: Alles auswählen
function DigUpDatabase71Backup
{
$BasicPath = resolve-path $args
$TargetPath = (get-item $args).parent.FullName
$BackupPath = '\SQLDemoDatabase\CommonAppData\Microsoft\Microsoft Dynamics NAV\71\Database\Demo Database NAV (7-1).bak'
$Fullpath = [string]::Concat($BasicPath,$BackupPath)
Copy-Item -path $FullPath -Destination $TargetPath
Write-Host "Backup file copied to $TargetPath"
}
FĂĽr NAV 2013
- Code: Alles auswählen
function DigUpDatabase70Backup
{
$BasicPath = resolve-path $args
$TargetPath = (get-item $args).parent.FullName
$BackupPath = '\SQLDemoDatabase\CommonAppData\Microsoft\Microsoft Dynamics NAV\70\Database\Demo Database NAV (7-0).bak'
$Fullpath = [string]::Concat($BasicPath,$BackupPath)
Copy-Item -path $FullPath -Destination $TargetPath
Write-Host "Backup file copied to $TargetPath"
}
FĂĽr NAV 2009
- Code: Alles auswählen
function DigUpDatabase60Backup
{
$BasicPath = resolve-path $args
$TargetPath = (get-item $args).parent.FullName
$BackupPath = '\SQLDemoDatabase\CommonAppData\Microsoft\Microsoft Dynamics NAV\60\Database\Demo Database NAV (6-0).bak'
$Fullpath = [string]::Concat($BasicPath,$BackupPath)
Copy-Item -path $FullPath -Destination $TargetPath
Write-Host "Backup file copied to $TargetPath"
}
Beispiele fĂĽr das Zuweisen der Aliase in der Profildatei
- Code: Alles auswählen
Set-Alias du80db DigUpDatabase80Backup
Set-Alias du71db DigUpDatabase71Backup
Set-Alias du70db DigUpDatabase70Backup
Set-Alias du60db DigUpDatabase60Backup