Skip to main content
Dynamics 365

How to get back the ‘hotfix directories’ from NAV 2015 Cumulative Update 1

Since Cumultive Update 1 for Microsoft Dynamics NAV 2015, we have not provided the socalled ‘hotfix directories’ in the hotfix download, but we know that some people have a need for these folders. So in November 2014, we published this blog post with guidance for how to use a Windows PowerShell script that gives you the same folder structure.

This blog has been updated in November 2015 with an updated script so that you can use the same script for Microsoft Dynamics NAV 2016.

In order to use it:

  1. Copy the code below to a local file, and save the file as Copy-UpdateFilesToBatchDirectory.ps1.
  2. Unzip the DVD zip file from the Cumulative Update to a local folder.
  3. Run the script.
    1. Open the Microsoft Dynamics NAV Administration Shell as Administrator
    2. Run this command:
      Import-Module DIRECTORY\Copy-UpdateFilesToBatchDirectory.ps1
      where DIRECTORY is the location where you saved the .ps1 file.
    3. Run this command:
      Copy-UpdateFilesToBatchDirectory -DvdDirectory DVDDIRECTORY -BatchDirectory BATCHDIRECTORY
      where DVDDIRECTORY is the location where you unzipped the DVD from the update, and BATCHDIRECTORY is the location where you want to files to be copied to.
  4. It should take a couple of minutes to go through the process, but when done, you should get the same structure as you had before, located in the path you specified for -BatchDirectory

Here is the script:

<#
 .SYNOPSIS
 This cmdlet copies all the DVD files to create a batch ready set of files.
 .DESCRIPTION
 This cmdlet copies all the DVD files to create a batch ready set of files..
 It skips files that are not needed in installation scenarios such as .config files.
 .PARAMETER DvdDirectory
 Specifies the directory where the uncompressed Cumulative Update DVD subdirectory is located.
 .PARAMETER BatchDirectory
 Specifies the directory that should hold the result set of files, i.e., the directory to copy to.
#>
function Copy-UpdateFilesToBatchDirectory
{
 [CmdletBinding()]
 param (
 [parameter(Mandatory=$true)]
 [string] $DvdDirectory,

 [parameter(Mandatory=$true)]
 [string] $BatchDirectory
 )
 PROCESS
 {
 # Copy all the Dvd files to a _TEMP folder
 if (Test-Path -Path $DvdDirectory\"RoleTailoredClient\program files\Microsoft Dynamics NAV\80")
 {
 $NavVersion = "80"
 }
 elseif (Test-Path -Path $DvdDirectory\"RoleTailoredClient\program files\Microsoft Dynamics NAV\90")
 {
 $NavVersion = "90"
 }
 else
 {
 Write-Host Please check your DvdDirectory parameter
 return 
 }

 Write-Verbose "Copying files from $DvdDirectory to $BatchDirectory\_Temp\..."
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\RTC\Add-ins
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\NST\Add-ins
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\BPA
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\"WEB CLIENT"
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\OUTLOOK
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\ADCS
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\HelpServer
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\UpgradeToolKit
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\WindowsPowerShellScripts
 if ($NavVersion -eq "90")
 {
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\CrmCustomization
 New-Item -ItemType Directory -Force -Path $BatchDirectory\_Temp\TestToolKit
 }

 Copy-Item $DvdDirectory\"RoleTailoredClient\program files\Microsoft Dynamics NAV\"$NavVersion"\RoleTailored Client"\* -destination $BatchDirectory\_Temp\RTC -recurse -Force
 Copy-Item $DvdDirectory\"ServiceTier\program files\Microsoft Dynamics NAV\"$NavVersion"\Service"\* -destination $BatchDirectory\_Temp\NST -recurse -Force
 Copy-Item $DvdDirectory\BPA\* -destination $BatchDirectory\_Temp\BPA -recurse -Force
 Copy-Item $DvdDirectory\"WebClient\Microsoft Dynamics NAV\"$NavVersion"\Web Client"\* -destination $BatchDirectory\_Temp\"WEB CLIENT" -recurse -Force
 Copy-Item $DvdDirectory\"Outlook\program files\Microsoft Dynamics NAV\"$NavVersion"\OutlookAddin"\* -destination $BatchDirectory\_Temp\OUTLOOK -recurse -Force
 Copy-Item $DvdDirectory\"ADCS\program files\Microsoft Dynamics NAV\"$NavVersion"\Automated Data Capture System"\* -destination $BatchDirectory\_Temp\ADCS -recurse -Force
 Copy-Item $DvdDirectory\"HelpServer\DynamicsNAV"$NavVersion"Help"\* -destination $BatchDirectory\_Temp\HelpServer -recurse -Force
 Copy-Item $DvdDirectory\"UpgradeToolKit"\* -destination $BatchDirectory\_Temp\UpgradeToolKit -recurse -Force
 Copy-Item $DvdDirectory\"WindowsPowerShellScripts"\* -destination $BatchDirectory\_Temp\WindowsPowerShellScripts -recurse -Force
 if ($NavVersion -eq "90")
 {
 Copy-Item $DvdDirectory\"CrmCustomization"\* -destination $BatchDirectory\_Temp\CrmCustomization -recurse -Force
 Copy-Item $DvdDirectory\"TestToolKit"\* -destination $BatchDirectory\_Temp\TestToolKit -recurse -Force
 }
 Write-Verbose "Done copying files RTC files from $DvdDirectory to $BatchDirectory\_Temp."
 
 # Delete files that are not needed for an installation scenario
 Write-Verbose "Deleting files from $BatchDirectory that are not needed for the batch directory..."

 Get-ChildItem $BatchDirectory\_Temp -include '*.chm' -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
 Get-ChildItem $BatchDirectory\_Temp -include '*.hh' -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
 Get-ChildItem $BatchDirectory\_Temp -include '*.config' -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
 Get-ChildItem $BatchDirectory\_Temp -include '*.ico' -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
 Get-ChildItem $BatchDirectory\_Temp -include '*.flf' -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
 Get-ChildItem $BatchDirectory\_Temp -include '*.sln' -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\RTC\ 'ENU')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\RTC\ 'en-US')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\RTC\ 'Images')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\RTC\ 'SLT')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\RTC\ 'ReportLayout')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\BPA\ 'Scripts')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\HelpServer\ 'css')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\HelpServer\ 'help')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\HelpServer\ 'images')
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\_Temp\WindowsPowerShellScripts\ 'ApplicationMergeUtilities')
 Write-Verbose "Done deleting files from $BatchDirectory that are not needed for for the batch directory."

 # Copy the result to the requested directory and remove the _Temp folder
 Copy-Item $BatchDirectory\_Temp\* -destination $BatchDirectory\ -recurse -Force
 RemoveUnnecessaryDirectory (Join-Path $BatchDirectory\ '_Temp')
 }
}

function RemoveUnnecessaryDirectory
{
 param ([string]$directory)
 Remove-Item $directory -force -Recurse -ErrorAction SilentlyContinue
}

Hope this helps,

Jorge