Skip to content

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

Closed

Description

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

Activity

  1. iSazonov commented on Sep 22, 2017

    @iSazonov
    Collaborator

    Jeremy Bidet (@JeremyBidet) Thanks for your report!

    Unix systems don't support COM. You could use remoting from Unix to Windows system.

    We should return more user-friendly message.

    /cc Dongbo Wang (@daxian-dbw)

  2. added
    WG-Engine
    Issue-Bug
    on Sep 22, 2017
  3. JeremyBidet commented on Sep 22, 2017

    @JeremyBidet
    Author

    Thanks to you Ilya (@iSazonov) for your feedback

  4. changed the title [-]Using ComObject Word.Application[/-] [+]Using ComObject Word.Application on Linux should have better error message[/+] on Sep 22, 2017
  5. SteveL-MSFT commented on Sep 22, 2017

    @SteveL-MSFT
    Member

    Reopening this to have better error message

  6. added
    Up-for-Grabs
    on Sep 22, 2017
  7. changed the title [-]Using ComObject Word.Application on Linux should have better error message[/-] [+]Using ComObject Word.Application on Linux[/+] on Sep 22, 2017
  8. daxian-dbw commented on Sep 22, 2017

    @daxian-dbw
    Member

    have better error message

    Or to not expose -ComObject on Unix plats?

  9. SteveL-MSFT commented on Sep 22, 2017

    @SteveL-MSFT
    Member

    daxian, even better!

  10. changed the title [-]Using ComObject Word.Application on Linux[/-] [+]-ComObject should not be exposed on systems where it is not supported[/+] on Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Issue-BugResolution-FixedUp-for-GrabsWG-Engine

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions