Asked by:
ScanErrorException when using Poweshell MetadataExchange

Question
-
Hello,
I have been trying to use the PowerShell module MetadataExchange on Windows 10 without luck.
I am setting up new build machines which need to run a PowerShell script using the MetadataExchange module. This script is used to generate an EMX file to be used later on. Previous machines have been working fine, but none of the new ones. The previous ones are on Windows 7 when the new ones are on Windows 10.
The script being run is:
[CmdletBinding()] Param( [Parameter(Mandatory=$False,Position=0)] [string]$path="ProductName-126709.dll", [Parameter(Mandatory=$False,Position=1)] [string]$product="ProductName", [Parameter(Mandatory=$False,Position=2)] [string]$version="1.0", [Parameter(Mandatory=$False,Position=3)] [string]$output="out.emx" ) if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") { if ($myInvocation.Line) { &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line }else{ &"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args } exit $lastexitcode } Import-Module -Name MetadataExchange $dirPath = $path $productName = $product $productVersion = $version $outputFile = $output $dirFiles = Get-ChildItem -Path $dirPath -Include @("*.dll","*.vst3") -rec Write-Host "folder list : $dirFiles" Clear-Metadata Write-Host "Clearing MEtadata" Write-Host "New Product -Name $productName -Version $version -Lifecycle CurrentRelease " $productName = New-Product -Name "$productName" -Version "$version" -Lifecycle CurrentRelease Write-Host "Add Product" Add-Product -Product $productName foreach($file in $dirFiles) { Write-Host "New-ProductFile $file.FullName | add-ProductFile $productName" Write-Host "$file.FullName " New-ProductFile $file.FullName | add-ProductFile $productName } Export-MetaData $outputFile return $outputFile
I have installed WindowsLive Essentials with Messenger (this is required by the module), then installed the MetadataExchange module for PowerShell.
I have changed the execution policy to "Unrestricted" for both CurrentUser and LocalMachine.
When I run the script and give it a valid DLL (which worked in the past) the script fails executing "New-Product" and display the error:
New-ProductFile : Unknown error. Check the event log for more details. At D:\PowerShellMetadataTest\CreateEmx.ps1:56 char:5 + New-ProductFile $file.FullName | add-ProductFile $productName + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [New-ProductFile], ScanErrorException + FullyQualifiedErrorId : Microsoft.Telemetry.MetadataExchange.ScanErrorException,Microsoft.Telemetry.MetadataExchange.Commands.NewProductFileCommand
On some machines it works if it's run with an elevated PowerShell Windows but not on normal privileges. On some other machines it doesn't work at all. It looks to me like it's a permission issue to execute the DLL from the module or to read the file, but I can't figure why.
I have checked the module DLL permissions, the files permissions, and the main user is administrator. What am I missing?
This is the module content:
Mode LastWriteTime Length Name ---- ------------- ------ ---- d---- 12/15/2017 3:07 PM en-us -a--- 5/23/2013 8:10 AM 14122 MetadataExchange.ps1xml -a--- 5/23/2013 8:10 AM 20356 MetadataExchange.psd1 -a--- 5/23/2013 8:10 AM 31384 Microsoft.Telemetry.Authentication.dll -a--- 5/23/2013 8:10 AM 54424 Microsoft.Telemetry.Core.dll -a--- 5/23/2013 8:10 AM 38552 Microsoft.Telemetry.MetadataExchange.Cmdlets.dl -a--- 5/23/2013 8:10 AM 170136 Microsoft.Telemetry.MetadataExchange.Core.dl
Also as a side question, this module is very old (which might be the problem on Windows 10), you can't even find the WindowsEssential installer on Microsoft website anymore; is there a replacement solution for that with a more modern technology? Basically we are trying to get information from Microsoft server whenever our DLL crashes so we can get the crash reports.
Kind regards,
Maxime- Moved by Hart Wang Tuesday, December 19, 2017 6:04 AM
Friday, December 15, 2017 2:20 AM
All replies
-
Hi,
Thank you for posting here.
Since your issue is related to power shell development, you can post the issue on here. I will move case to off-topic forum
https://social.technet.microsoft.com/Forums/windows/en-US/home?forum=winserverpowershell
If the windows 10 update cause the issue, you can write your feedback on here.
Best Regards,
Hart
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Friday, December 15, 2017 6:21 AM -
Hi,
facing the same issue on Windows 10 latest as well as on Server 2016.
Did anybody solve it so far?
Jan
Saturday, January 27, 2018 8:41 PM