DevCDR icon indicating copy to clipboard operation
DevCDR copied to clipboard

Suggestion: Expand PowerShell return results

Open DwightGappa opened this issue 4 years ago • 3 comments

It would be nice to have an expanded PowerShell script results pane. The need comes from running scripts than can generate multiline output/errors. It is hard to read long script output right with jammed on the end of the line.

My suggestion would be to have an optional/minimized/hidden by default textbox (about the same size as the command entry textbox) below the custom command text area.

DwightGappa avatar Sep 04 '20 02:09 DwightGappa

The ScriptResult Column is not the right place to store large results... It's in memory only and the status can be overwritten from any upcomming status...

I would recommend to use Azure Log-Analytics to store your PowerShell results. Then you can access the results for at least 30 days. If you install the latest Version of the DevCDR Agent, you also get a PowerShell Module for Log-Analytics. To Configure it, run the following command once:

Set-LogAnalytics -WorkspaceID "<your WorkspaceID>" -SharedKey "<your shared key>" -LogType "DevCDR"

then you can simply write a log entry by:

Write-Log -JSON ([pscustomobject]@{Computer = $env:COMPUTERNAME; EventID = 1000; Description = "custom log text here"})

rzander avatar Sep 06 '20 12:09 rzander

When I was thinking about this suggestion, I have several PowerShell scripts that are written for manual execution through the local native PowerShell host i.e. PowerShell console window, which can have multiple lines returned or throw multiline errors i.e. the default error output. I have no intention at this point of storing the results any of PowerShell that is designed to run in the console is Azure Log analytics.

DwightGappa avatar Sep 13 '20 05:09 DwightGappa

You can also enable Log-Analytics on the DevCDR Instance: https://github.com/rzander/DevCDR/wiki/Enable-logging-in--Azure-Log-Analytics#activate-log-analytics-on-devcdr-instance ... so everything you get in the devcdr console is logged... no need to change your scripts.. For long term, you should update your PoweShell scripts to return a proper result... and the devcdr console should not be the place to store the results as clients can disappear or just update the result in devcdr with other status information... If you have multiple admins using the console, the can trigger other command while you are waiting for a result...

rzander avatar Sep 13 '20 17:09 rzander