Format output as property

Example:

get-printer | format-table -wrap

Gets you data with the columns expanded. What I would like to get is output where I'll have heading (hard return) value (hard return), next heading (hard return), next value...

As it iterates through each property and each printer. Is there a way to do this?

Apologies for formatting, I'm on mobile

Posted Jun 23, 2020, 7:05 PM UTC

17
jheinikel•

Wouldn't you just rather have it formatted in a list so the property and value show up in a format you can reference?

Get-Printer | FL
6
GeenMachineOP•

Thanks, this is what I was wanting to get - still learning and format list escaped me.

1
WadeEffingWilson•

If there are key:values that you know are going to be there, you can use select.

Get-Printer | select <header1>,<header2> | ft

It depends on what us handed back from the Get-Printer cmdlet and what its type is. There may be other approaches depending on that.

3
GeenMachineOP•

Thanks! I'll investigate further later.

3
WadeEffingWilson•

Feel free to reach out if you need further help.

3
GeenMachineOP•

Thanks, your reply and u/jheinkel were what I wanted. What I ended up with a command was:

get-Printer | select Name, Drivername, PortName | FL

3
WadeEffingWilson•

Awesome!

Thanks for the feedback. Glad I was able to help.

1