Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Formatting powershell results

$
0
0

Hello,<o:p></o:p>

I'm using JumpCloud powershell module for exporting command results.

I'm trying to format powershell result but unable to export all columns. 
>get-jccommandresult -byid 5c7fe06eba87c603cb1ddf4a | select name, command, system, output | format-table -wrap -autosize                     <o:p></o:p>

This works perfectly fine, but  i'm only selecting specific jccommandresult and i want to export all jccommandresults without filtering by id. But when I export, the “output” column is blank. I’m not sure if it is because of the output column format in the result displayed.

Below are the commands that I tried but couldn’t get “output” column result in exported file.

(I want the result to be in table format so that I can filter it by name and system so I didn’t use format-list. Also, I read somewhere that format-table wont work with export-csv but I tried that too.)

get-jccommandresult | Select name,command,system,output,_id | export-csv -path C:\Users\abc\Documents\JCcmdres.csv -append

get-jccommandresult | select name, command, system,output,_id | format-table -wrap -autosize |out-file -filepath C:\Users\abc\Documents\JCcmdres.csv -width 4096 -append

get-jccommandresult | select name, command, system,output,_id | Out-GridView

get-jccommandresult | Select name,output,system |convertto-csv -notypeinformation | out-file -filepath C:\Users\abc\Documents\JCcmdres.csv -width 4096 -append


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>