Skip to content

Elevated Powershell scripts output progress bar as XML object #60

@gildas

Description

@gildas

When running a powershell script in elevated mode, the output received by Packer contains the Progress object (System.Management.Automation.PSCustomObject) as an XML blob.

Example of a script that install .Net 3.5 via the Install-WindowsFeature Cmdlet (that produces a typical progress indicator in your Powershell session usually). Here is the output as shown when running packer:

==> virtualbox-windows-iso: Provisioning with shell script: ./scripts/install-dotnet35.ps1
    virtualbox-windows-iso: #< CLIXML
    virtualbox-windows-iso: Script started at 2015-06-01 02:14:53
    virtualbox-windows-iso: Installing .Net 3.5
    virtualbox-windows-iso: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="
SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</
I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI>...

I cut the XML as it is quite huge.

IMO, that XML should not be visible (at least) or process properly by showing some progress text + % value (that'd be the best).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions