Find D365FO labels in Powershell

You can use Dynamics 365 > Find labels… in Visual Studio to find D365FO labels, but its capabilities are quite limited. Sometimes a better option is searching through the underlying text files directly and you can easily automate it with Powershell.

The following script looks at all label files for US English and finds all labels containing either PowerBI or Power BI. It skips label comments, because you’re typically interested only in labels and not their comments.

$packagesDir = 'C:\AOSService\PackagesLocalDirectory\'
$labelFiles = ls $packagesDir\*\*\AxLabelFile\LabelResources\en-US\*.txt
$labelFiles | Select-String -Pattern '^(?! ;).*=.*Power ?BI' | select Line, Filename, LineNumber

You might think this approach will be slow, but it actually returns result very quickly.

4 Comments

  1. Works well, however in 2012 you could use < to get all labes starting with, do know if that is possible in vs label search?

    • Actually, I’ve found that you can use regular expressions in Label Search as well. I don’t know if it’s a new feature or I simply overlooked it before.
      Therefore you can use ^ (instead of <) to find label values beginning with a particular text (e.g. ^Customer).

  2. Hi Martin,
    How can we get all the menu items and label with description?

    Best Regards
    Arun Garg

Comments are closed.