Skip to content

-ComObject should not be exposed on systems where it is not supported #4897

@JeremyBidet

Description

@JeremyBidet

Hello everybody, i am encountering an issue.
I need to convert some old XML files (encoded with word 2006 .xml schema) as PDF.
I already used PowerShell and ComObject to do this on a Windows system :

$word = New-Object -ComObject Word.Application
$word.Documents.Open($filename).SaveAs($filename.replace(".xml", ".pdf"), 17)

but now I have to automate this process on a Linux system (every XML files are generated onto).
PowerShell on Linux able to me to use these commands but not ComObject due to a missing of api-ms-win-core-com-l1-1-0.dll

Is there any way to load this dll into a Linux system ? If not, is there any other way to do the same ?

Command

$word = New-Object -ComObject Word.Application

Expected behavior


Actual behavior

New-Object : Unable to load DLL 'api-ms-win-core-com-l1-1-0.dll': The specified module or one of its dependencies could not be found.
 (Exception from HRESULT: 0x8007007E)
At line:1 char:9
+ $word = New-Object -ComObject Word.application
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-Object], DllNotFoundException
    + FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommand

Environment data

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.7
OS                             Linux 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.Up-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Enginecore PowerShell engine, interpreter, and runtime

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions