Skip to content

Export-CliXml shouldn't require writing to a file #3898

Closed

Description

The Export-CliXml command should offer a parameter set that emits a string, instead of writing the result to a file. Right now, it only supports outputting CLIXML to a file via the -Path or -LiteralPath parameters.

Cheers,
Trevor Sullivan

Activity

  1. mklement0 commented on May 31, 2017

    @mklement0
    Contributor

    Given how this distinction is handled in existing cmdlets (e.g., Export-Csv / ConvertTo-Csv), that would probably call for a new cmdlet named ConvertTo-CliXml, plus a matching ConvertFrom-CliXml.

  2. RichardSiddaway commented on Jun 6, 2017

    @RichardSiddaway

    Struggling to see the use case for Clixml representation of a an object just in memory. The CliXml cmdlets, as I understand them, are about persisting objects

  3. pcgeek86 commented on Jun 6, 2017

    @pcgeek86
    Author

    There are many different places you might want to persist objects. The filesystem is just one place.

  4. pldmgg commented on Oct 17, 2017

    @pldmgg

    Just came across a decent use case for this...

    Environment variables currently on take strings, so storing a complex object as an environment variable is not really possible. But if Export-Clixml could export a string to an environment variable, then we could relatively easily use Import-Clixml to re-hydrate the object.

  5. markekraus commented on Oct 17, 2017

    @markekraus
    Contributor

    If this followed the convention of CSV, it would actually be better to have a ConvertTo-Clixml cmdlet as well as a ConvertFrom-Clixml One reason I could think of this as useful is to pass the persisting object to things other than files, such as network streams or as body data in HTTP without needing to write to a file first.

  6. pcgeek86 commented on Oct 18, 2017

    @pcgeek86
    Author

    Building on top of what Mark Kraus (@markekraus) mentioned, another use case would be sending the CLIXML off to a message queue for processing by a different consumer application. I should not have to write the CLIXML to disk, and then read it again, to accomplish this.

  7. charlieschmidt commented on Oct 21, 2017

    @charlieschmidt

    @powershell/powershell grabbing, if i can?

    Progress on this: https://github.com/charlieschmidt/PowerShell/tree/powershell-3898-convertfromto-clixml
    I'll get the tests & docs added this weekend and do a proper PR

  8. added 2 commits that reference this issue on Jan 8, 2018
    980ef33
    a6e6c30
  9. Nillth commented on Oct 15, 2019

    @Nillth

    As a simple workaround how about this...

    `$SerializedString = [System.Management.Automation.PSSerializer]::Serialize($Object)

    $BackToObject = [System.Management.Automation.PSSerializer]::Deserialize($SerializedString)`

  10. mklement0 commented on Oct 15, 2019

    @mklement0
    Contributor

    It's a viable workaround, but I wouldn't call it simple, because this behind-the-scenes type is neither widely known nor easy to remember.

    As an aside: Serialize() defaults to depth 1, whereas Export-CliXml defaults to depth 2.

  11. Shriram0908 commented on May 28, 2020

    @Shriram0908
    Contributor

    I like to work on this issue. I hope that the cmdlets are still needed.

  12. vexx32 commented on May 28, 2020

    @vexx32
    Collaborator

    I see there was an old PR that never got merged and is now closed... but yeah we can still use this. Go for it! 🙂

  13. foxx commented on Oct 22, 2022

    @foxx

    First of all, thanks to everyone for getting this fixed.

    Are there any indications on which release this might land in?

    It's a drop in the ocean of the 3.2k open issues, but would be nice to get this issue closed out :)

  14. doctordns commented on Jun 9, 2023

    @doctordns
    Collaborator

    So far as I can tell, this PR has not been merged. I can't see any trace of it in either 7.4 preview 3 or a recent daily build.

    Are there folks that want to take this on and complete the PR? If not, we should close this.

  15. God-damnit-all commented on Sep 15, 2023

    @God-damnit-all
    Contributor

    So far as I can tell, this PR has not been merged. I can't see any trace of it in either 7.4 preview 3 or a recent daily build.

    Are there folks that want to take this on and complete the PR? If not, we should close this.

    Shri Ram K S (@Shriram0908) disappeared right before the finish line, it seems. 😕

  16. ArmaanMcleod commented on Jan 6, 2024

    @ArmaanMcleod
    Contributor

    So far as I can tell, this PR has not been merged. I can't see any trace of it in either 7.4 preview 3 or a recent daily build.

    Are there folks that want to take this on and complete the PR? If not, we should close this.

    Thomas Lee (@doctordns) I've created a new PR which should address this. Will wait for feedback and hopefully get this one merged since I needed this recently and would be great to have these cmdlets in 7.4.

  17. microsoft-github-policy-service commented on Jul 26, 2024

    @microsoft-github-policy-service
    Contributor

    📣 Hey Trevor Sullivan (@pcgeek86), how did we do? We would love to hear your feedback with the link below! 🗣️

    🔗 https://aka.ms/PSRepoFeedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueIssue-Enhancementthe issue is more of a feature request than a bugUp-for-GrabsUp-for-grabs issues are not high priorities, and may be opportunities for external contributorsWG-Cmdletsgeneral cmdlet issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions