microsoftgraph / msgraph-sdk-powershell

Powershell SDK for Microsoft Graph
https://www.powershellgallery.com/packages/Microsoft.Graph
Other
696 stars 168 forks source link

Binary cmdlets spam the information stream inappropriately and logs sensitive information to that stream #373

Closed KirkMunro closed 3 years ago

KirkMunro commented 4 years ago

This is related to #371, which calls out the need to replace the use of Write-Information with Write-Verbose in your auto-generated PowerShell script (psm1 and ps1) files.

Your auto-generated binary cmdlets are spamming the information stream, which results in a lot of undesirable information for end users if a script is run using the PowerShell SDK.

Consider the following simple example:

$ps = [powershell]::Create()
$ps.AddScript(@'
$certificateThumbprint = 'Enter your cert thumbprint here'
$appId = 'Enter your Azure application ID here'
$tenantNameOrId = 'Enter your Azure tenant name or ID here'
Connect-Graph -CertificateThumbprint $certificateThumbprint -ClientId $appId -TenantId $tenantNameOrId
$domain = Get-MgDomain
'@).Invoke()
$ps.Streams.Information

This command outputs the following on my system:

Welcome To Microsoft Graph!
Loaded Azure profile 'v1.0-beta' for module 'Microsoft.Graph.Identity.Domains'
Loaded Azure profile 'v1.0-beta' for module 'Microsoft.Graph.Identity.Domains'
Loaded Module 'Microsoft.Graph.Identity.Domains'
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData

None of that information is useful to a scripter, but the information stream cannot be easily silenced this way without workarounds (see PowerShell/PowerShell/issues/13631). The end result is just noise.

Worse, looking more closely at that data I see some auth token information in there, which I most certainly would not want captured in a log file, so this needs to be off by default in all execution paths. To get that, you're going to have to move away from using the information stream. Plus, you're currently writing your information output as text in tags??? That doesn't make sense. Tags is to tag an information stream entry with something that can be used to categorize or process the message in that stream. Tags is not for the messages themselves. That is just wrong.

You really need to re-think your message handling in your binary cmdlets, because you're not doing something right. At best I would log the Microsoft.Graph.PowerShell.Runtime.EventData as debug messages (not verbose, please -- don't spam end users who want just a little more information to troubleshoot a command that they are trying to use), but you need to be careful because in Windows PowerShell 5.1, the Debug stream acts as a dynamic breakpointer (sort of -- it is used to enter nested prompts on demand), and that behavior was not corrected until PowerShell 7.x.

My recommendation: Move all of this text to a conditional invocation of WriteDebug, that is only invoked if DebugPreference is not set to Inquire (this sufficiently gets around the dynamic breakpointer behavior that was corrected in PowerShell/PowerShell/pull/8195).

AB#6781

o-l-a-v commented 3 years ago

I set $InformationPreference to 'Continue' and ended up being flooded with Microsoft.Graph.PowerShell.Runtime.EventData. That was a unpleasent experience.

Running inside PowerShell ISE, latest version of all Microsoft.Graph modules.

This is not intended behavior I hope?

Command output

PS C:\Users\birola> $MgDevices = [array](Get-MgDevice -All)
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData
Microsoft.Graph.PowerShell.Runtime.EventData

PS C:\Users\birola> 

$PSVersionTable

Name                           Value                                                                                                                                          
----                           -----                                                                                                                                          
PSVersion                      5.1.19041.1151                                                                                                                                 
PSEdition                      Desktop                                                                                                                                        
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                        
BuildVersion                   10.0.19041.1151                                                                                                                                
CLRVersion                     4.0.30319.42000                                                                                                                                
WSManStackVersion              3.0                                                                                                                                            
PSRemotingProtocolVersion      2.3                                                                                                                                            
SerializationVersion           1.1.0.1                                                                                                                                        

Get-Module


ModuleType Version    Name                                ExportedCommands                                                                                                    
---------- -------    ----                                ----------------                                                                                                    
Script     1.0.0.0    ISE                                 {Get-IseSnippet, Import-IseSnippet, New-IseSnippet}                                                                 
Script     1.7.0      Microsoft.Graph.Authentication      {Add-MgEnvironment, Connect-MgGraph, Disconnect-MgGraph, Get-MgContext...}                                          
Script     1.7.0      Microsoft.Graph.DeviceManagement    {Get-MgDeviceManagement, Get-MgDeviceManagementAdvancedThreatProtectionOnboardingStateSummary, Get-MgDeviceManage...
Script     1.7.0      Microsoft.Graph.Identity.Directo... {Confirm-MgAdministrativeUnitMemberGroup, Confirm-MgAdministrativeUnitMemberObject, Confirm-MgContactMemberGroup,...
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Computer, Add-Content, Checkpoint-Computer, Clear-Content...}                                                  
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {ConvertFrom-SecureString, ConvertTo-SecureString, Get-Acl, Get-AuthenticodeSignature...}                           
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-Type, Clear-Variable, Compare-Object...}                                                           
Manifest   3.0.0.0    Microsoft.WSMan.Management          {Connect-WSMan, Disable-WSManCredSSP, Disconnect-WSMan, Enable-WSManCredSSP...}                                     
JustinGrote commented 2 years ago

For reference, these are the decoded eventdata messages. These should be emitted the typical method the host uses for Write-Information

💥❯ get-mggroup 6>&1 |% messagedata |% message
CMDLET BEGIN PROCESSING The contents are 'CmdletBeginProcessing' and ''
CMDLET BEGIN PROCESSING Parameter: ''
CMDLET BEGIN PROCESSING RequestMessage ''
CMDLET BEGIN PROCESSING Response: ''
CMDLET BEGIN PROCESSING Value: '0'
CMDLET BEGIN PROCESSING ExtendedData Type: ''
CMDLET BEGIN PROCESSING ExtendedData ''
CMDLET PROCESS RECORD START The contents are 'CmdletProcessRecordStart' and ''
CMDLET PROCESS RECORD START Parameter: ''
CMDLET PROCESS RECORD START RequestMessage ''
CMDLET PROCESS RECORD START Response: ''
CMDLET PROCESS RECORD START Value: '0'
CMDLET PROCESS RECORD START ExtendedData Type: ''
CMDLET PROCESS RECORD START ExtendedData ''
CMDLET PROCESS RECORD ASYNC START The contents are 'CmdletProcessRecordAsyncStart' and ''
CMDLET EXCEPTION ExtendedData ''
Get-MgGroup_List: Authentication needed, call Connect-MgGraph.
CMDLET PROCESS RECORD END The contents are 'CmdletProcessRecordEnd' and ''
CMDLET PROCESS RECORD END Parameter: ''
CMDLET PROCESS RECORD END RequestMessage ''
CMDLET PROCESS RECORD END Response: ''
CMDLET PROCESS RECORD END Value: '0'
CMDLET PROCESS RECORD END ExtendedData Type: ''
CMDLET PROCESS RECORD END ExtendedData ''
CMDLET END PROCESSING The contents are 'CmdletEndProcessing' and ''
CMDLET END PROCESSING Parameter: ''
CMDLET END PROCESSING RequestMessage ''
CMDLET END PROCESSING Response: ''
CMDLET END PROCESSING Value: '0'CMDLET END PROCESSING ExtendedData Type: ''
CMDLET END PROCESSING ExtendedData ''
o-l-a-v commented 2 years ago

For reference, these are the decoded eventdata messages. These should be emitted the typical method the host uses for Write-Information

Such detail should only be visible in the debug stream in my opinion, or behind a parameter or setting for the module. I use the information stream for human readable script output without generating output objects (which Write-Output does). Which is how I interperate what that stream should be used for. Shouldn't be debug information AFAIK.

JustinGrote commented 2 years ago

Yeah this should be written to the debug or verbose stream IMHO.