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

As you might have read from the comments on the Cumulative Update 1 for Microsoft Dynamics NAV 2015 has been released post, we are no longer providing the 'hotfix directories' in the hotfix download but some people have hinted that they have the need for them. We have created a PowerShell script that should give you back the same folder structure as was present before, and we are providing the source of the script, so that you can modify it to meet your naming needs.

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 2015 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:

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

        [parameter(Mandatory=$true)]
        [string] $BatchDirectory
    )
    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\80\RoleTailored Client"\* -destination $BatchDirectory\_Temp\RTC -recurse -Force
        Copy-Item $DvdDirectory\"ServiceTier\program files\Microsoft Dynamics NAV\80\Service"\* -destination $BatchDirectory\_Temp\NST -recurse -Force
        Copy-Item $DvdDirectory\BPA\* -destination $BatchDirectory\_Temp\BPA -recurse -Force
        Copy-Item $DvdDirectory\"WebClient\Microsoft Dynamics NAV\80\Web Client"\* -destination $BatchDirectory\_Temp\"WEB CLIENT" -recurse -Force
        Copy-Item $DvdDirectory\"Outlook\program files\Microsoft Dynamics NAV\80\OutlookAddin"\* -destination $BatchDirectory\_Temp\OUTLOOK -recurse -Force
        Copy-Item $DvdDirectory\"ADCS\program files\Microsoft Dynamics NAV\80\Automated Data Capture System"\* -destination $BatchDirectory\_Temp\ADCS -recurse -Force
        Copy-Item $DvdDirectory\"HelpServer\DynamicsNAV80Help"\* -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 '*.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
}

 

Hope this helps,

Jorge

Comment List
Related
Recommended