AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 13.01.2018, 20:21   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
yetanotherdynamicsaxblog: List hotfixes using PowerShell in D365FO (AX7)
Источник: http://yetanotherdynamicsaxblog.blog...rshell-in.html
==============

You probably already know that you can open Visual Studio and from the "Dynamics 365" menu, under "Addins" and "Apply Hotfix", you will find a grid that lists all the hotfixes installed on your environment. The list can be copied and pasted into Excel if you need a better view and you need to filter and search the list. It works, but it could be a bit easier.

In this post I will share a neat function you can use to list installed hotfixes using PowerShell. It inspired by the post from Microsoft Support (Thomas Treen), and I got some help by some of my fellow MVPs to get inspired (shout out to Martin Draab and Lane Swenka).

The function is as follows:

function Get-HotfixList()
{
# Find the correct Package Local Directory (PLD)
$pldPath = "\AOSService\PackagesLocalDirectory"
$packageDirectory = "{0}:$pldPath" -f ('J','K')[$(Test-Path $("K:$pldPath"))]

[array]$Updates = @()

# Get all updates XML
foreach ($packagefile in Get-ChildItem $packageDirectory\*\*\AxUpdate\*.xml)
{
[xml]$xml = Get-Content $packagefile
[string]$KBs = $xml.AxUpdate.KBNumbers.string

# One package may refer many KBs
foreach ($KB in $KBs -split " ")
{
[string]$package = $xml.AxUpdate.Name
$moduleFolder = $packagefile.Directory.Parent

$Updates += [PSCustomObject]@{
Module = $moduleFolder.Parent
Model = $moduleFolder
KB = $KB
Package = $package
Folder = $moduleFolder.FullName
}
}
}
return $Updates
}

With this function, you can list out the hotfixes to a resizable, sortable and searchable grid like this:

Get-HotfixList | Out-GridView

You can list out the hotfixes into a long string where each KB number is separated by a space. Then copy this string into LCS when searching for KBs you want to use in a Hotfix Bundle.

$list = Get-HotfixList | select KB | sort KB
$list = [string]::Join(" ", $list.KB)
$list

Obviously you can use the function to quickly search for a specific hotfix.

Get-HotfixList | where {$_.KB -eq "4055564"}

And one final example, when installing a hotfix bundle, one of the steps are to compile the modules patched, and while you can do a full compile of all modules in the application, you could also just compile only the ones patched. To create a distinct list of modules, run the following statement.

Get-HotfixList | select module | sort module | Get-Unique -AsString

A quick note on the Package Local Directory (PLD) path. In my script I shift between K and J drive. I have only used this script on VMs in the cloud. If you need to run this where the PLD path is on some other drive, you will need to change that in the script.

Источник: http://yetanotherdynamicsaxblog.blog...rshell-in.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
daxmusings: Upgrades, Updates and Hotfixes in AX7 Blog bot DAX Blogs 0 14.09.2017 13:11
daxmusings: Upgrades, Updates and Hotfixes in AX7 Blog bot DAX Blogs 0 23.06.2017 00:16
patrickmouwen: 1yr with AX7 Data Management – My top 12 learnings Blog bot DAX Blogs 2 12.10.2016 15:14
Microsoft Dynamics CRM Team Blog: Marketing with Dynamic List Blog bot Dynamics CRM: Blogs 0 09.11.2010 19:05
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 08:16.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.