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

Comments (11)

  1. Martin Nielander says:

    And it does not even have to be the Microsoft Dynamics NAV 2015 Administration Shell, it can be the standard Windows PowerShell as well.

  2. Manger says:

    Dear Jorge,

    this is a workaraound, but not a solution. You change something, and thousends of developpers have to do a further step (running the script) in the future for each Update.

    If you change the procedure back, only one person has to do additional work :-), and this only one time.

    Best regards

    manger

  3. Martin Nielander says:

    @Manger

    It really depends on what problem you are trying to resolve. The script, in this blog post, allows you to define your own process for duplicating folders and files already present in the DVD.

    An option is to not use the script and just extract the DVD file and either use the installer or copy from the DVD folder structure manually. The script is meant as a help for those who are not using the installer, not the one and only solution.

    /Martin

  4. Maarten says:

    Nice script.

    And now it would be nice to have a script that copies the update files to folders on the client/server…

  5. Martin Nielander says:

    @Maarten

    I guess you have a few options here. One thing is to modify the script but I think you should conside to look into the ClickOnceInstaller which has been released with NAV 2013 and NAV 2015.

    See more here: blogs.msdn.com/…/using-clickonce-to-deploy-the-microsoft-dynamics-nav-2013-roletailored-client-for-windows.aspx

    Here: msdn.microsoft.com/…/hh997056(v=nav.70).aspx

    And here: blogs.msdn.com/…/signing-a-clickonce-microsoft-dynamics-nav-windows-client-deployment-part-3-of-5.aspx

    /Martin

  6. Mads says:

    @Martin

    You seem to know your way around the Clickonce client.

    I can't seem to find a good/easy way to upgrade the clickonce clients. At this moment I need to upgrade both from 2013 R2 to 2015 CU1, and from 2015 to 2015 CU1. What is the best approach?

    Thanks

    /Mads

  7. Martin Nielander says:

    @Mads

    I'm not an expert on this, but I feel inspired by what you can achieve with the ClickOnce Installer when maintaining many clients. Please see these videos as they outline what to do to get up to speed with ClickOnce and what to do to maintain the experience for the NAV Windows Client. Please notice that the server is not supported by the ClickOnce Installer.

    To get started, see this video:

    community.dynamics.com/…/deploying-the-microsoft-dynamics-nav-windows-client-with-clickonce-part-1-of-5.aspx

    To maintain a ClickOnce experience, see this video (@Mads, maybe this is the video that can help you?):

    community.dynamics.com/…/upgrading-clickonce-deployed-by-microsoft-dynamics-nav-windows-client-part-2-of-5.aspx

    When signing is required, see this video:

    community.dynamics.com/…/signing-a-clickonce-microsoft-dynamics-nav-windows-client-deployment-part-3-of-5.aspx

    To deploy via a web server, see this video:

    community.dynamics.com/…/deploying-the-microsoft-dynamics-nav-windows-client-to-a-web-server-with-clickonce-part-4-of-5.aspx

    To deploy to an Azure blob, see this video:

    community.dynamics.com/…/deploying-the-microsoft-dynamics-nav-windows-client-to-azure-blob-storage-with-clickonce-part-5-of-5.aspx

    Please notice that the script in this blog post is not the same as using the ClickOnce Installer. The script in this blog is solely to create a flat copy/paste structure either by using the script as is or by modifying the script to fit your needs.

    /Martin

  8. Johannes Wikman says:

    Hi,

    Thanks for this script.

    Just some feedback after trying this out:

    – Do not remove .config-files. finsql.exe.config was changed in CU1, NSTCustomSettings.config is changed in CU2. (The NSTCustomSettings.config could be discussed in a patching scenario and might be removed…)

    – Do not remove .stx and .etx files, fin.stx was changed in CU1 and fin.etx in CU2.

    – Add the .resources.dll, .etx and .stx files from the Installers folder. All those has been changed in different updates.

    Best regards,

    Johannes

  9. BHochstetter says:

    Hi Jorge,

    Thank you for the script, it help me a lot the last CUs!

    We did some changes to the script, because we thought it deletes some files it should not delete and I want to use it also with NAV2016.

    function Copy-UpdateFilesToBatchDirectory
    {
    [CmdletBinding()]
    param (
    [parameter(Mandatory=$true)]
    [string] $DvdDirectory,

    [parameter(Mandatory=$true)]
    [string] $BatchDirectory,

    [parameter(Mandatory=$true)]
    [string] $VersionDirName
    )
    PROCESS
    {
    # Copy all the files from the DVD to a _TEMP folder
    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
    Copy-Item $DvdDirectory\”RoleTailoredClient\program files\Microsoft Dynamics NAV\$VersionDirName\RoleTailored Client”\* -destination $BatchDirectory\_Temp\RTC -recurse -Force
    Copy-Item $DvdDirectory\”ServiceTier\program files\Microsoft Dynamics NAV\$VersionDirName\Service”\* -destination $BatchDirectory\_Temp\NST -recurse -Force
    Copy-Item $DvdDirectory\BPA\* -destination $BatchDirectory\_Temp\BPA -recurse -Force
    Copy-Item $DvdDirectory\”WebClient\Microsoft Dynamics NAV\$VersionDirName\Web Client”\* -destination $BatchDirectory\_Temp\”WEB CLIENT” -recurse -Force
    Copy-Item $DvdDirectory\”Outlook\program files\Microsoft Dynamics NAV\$VersionDirName\OutlookAddin”\* -destination $BatchDirectory\_Temp\OUTLOOK -recurse -Force
    Copy-Item $DvdDirectory\”ADCS\program files\Microsoft Dynamics NAV\$VersionDirName\Automated Data Capture System”\* -destination $BatchDirectory\_Temp\ADCS -recurse -Force
    Copy-Item $DvdDirectory\”HelpServer\DynamicsNAV”$VersionDirName”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
    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 ‘*.etx’ -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
    #Get-ChildItem $BatchDirectory\_Temp -include ‘*.stx’ -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
    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 ‘*CustomSettings.config’ -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
    #Get-ChildItem $BatchDirectory\_Temp -include ‘*.stx’ -Recurse | Remove-Item -force -ErrorAction SilentlyContinue
    #Get-ChildItem $BatchDirectory\_Temp -include ‘*.etx’ -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
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\RTC\ ‘ENU’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\RTC\ ‘en-US’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\RTC\ ‘Images’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\RTC\ ‘SLT’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\RTC\ ‘ReportLayout’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\BPA\ ‘Scripts’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\”WEB CLIENT”\ ‘Resources’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\HelpServer\ ‘css’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\HelpServer\ ‘help’)
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\_Temp\HelpServer\ ‘images’)
    RemoveUnnecessaryClickOnceDirectory (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
    RemoveUnnecessaryClickOnceDirectory (Join-Path $BatchDirectory\ ‘_Temp’)
    }
    }

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

  10. navteam says:

    Hello all,
    We updated the blog post to remove a line in the suggested script that deleted the Resources folder for the Dynamics NAV Web client.

  11. Ondřej Závodný says:

    Hello Jorge,

    Language specific files are not copied 🙁 Would you add this to script?